Must use C++ for STDCOMP.H

By: Vincent Drake

Abstract: A common error for beginner programmers, this error message is easily resolved.


When I compile my code, I receive the following error message:

"Fatal F1003 c:BorlandBcc55includestdcomp.h 5: Error directive: Must use C++ for STDCOMP.H"

What does this error message mean?


The problem is that BCC32 is compiling your code for C yet you have included a C++ header file. The STDCOMP.H header file contains preprocessor directives that make sure it is being compiled for C++ and not C.

The Borland compiler determines whether to compile for C++ or for C based on your source file's extension. If your file has a ".CPP" file extension, it will be compiled as C++ code. If your file has a ".C" extension, or an extension the compiler does not recognize, the file will be compiled a C code.

To resolve this problem, make sure your source file extension reflects how you would like the file compiled. If you are encountering this specific error, it is likely that your source code has a ".C" extension and should be ".CPP"

Server Response from: ETNASC01