0

I am new to the C programming language. Recently, I have been trying to create my own header file in VS Code. Everything is underlined in red, and the error message reads-'Unknown Mnemonics'.

All my files are in the same directory. Interestingly, VS Code picks the included tag for the header file, while the header file continues to display Unknown Mnemonics. All function declarations are underlined in red too. See Below.

    #ifndef HEADER_FILE_H
    #define HEADER_FILE_H

    int _putchar(char c);
    void print_alphabet(void);
    void print_alphabet_x10(void);
    int _islower(int c);
    int _isalpha(int c);
    int print_sign(int c);
    int _abs(int);
    int print_last_digit(int);
    void jack_bauer(void);
    void times_table(void);
    int add(int, int);
    void print_to_98(int n);
    void print_times_table(int n);

    #endif

The name of my header file is: header_file.h

Please, how do I resolve this error?

Mav_Rick
  • 1
  • 1
  • 3
    Have you installed a C compiler or C extension for VS Code? – Irelia Jun 23 '22 at 01:03
  • 2
    Note that you should not, in general, create function, variable, tag or macro names that start with an underscore. Part of [C11 §7.1.3 Reserved identifiers](https://port70.net/~nsz/c/c11/n1570.html#7.1.3) says: — _All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use._ — _All identifiers that begin with an underscore are always reserved for use as identifiers with file scope in both the ordinary and tag name spaces._ See also [What does double underscore (`__const`) mean in C?](https://stackoverflow.com/q/1449181) – Jonathan Leffler Jun 23 '22 at 02:56
  • 1
    Welcome to StackOverflow! Please take the [tour] to learn how this site works. -- What is the **exact** name of your header file? Please [edit] your question and **add** this information. – the busybee Jun 23 '22 at 06:59
  • *VS Code picks the included tag for the header file* What does that mean? What is "the included tag"? – Gerhardh Jun 23 '22 at 07:37
  • Basically, VS Code is not recognising all my function declarations in a header file. I created a header file called header_file.h., using the tag #include "header_file.h". All function declarations are underlined in red, and the header file is useless. – Mav_Rick Jun 23 '22 at 10:35
  • The header would be useless if the compiler would not recognize it. The editor in VS Code is a different story. Maybe you need to tell VS Code where to look for headers. Do you include it using `<>` or `""`? – Gerhardh Jun 24 '22 at 08:31
  • I included the header file using "" – Mav_Rick Jun 24 '22 at 15:21

0 Answers0