Error directive : Must use STDCOMP.H
This error come out when I try to link various .cpp files and a .h file with borland 5.5
any help ???

Recommended Answers

All 6 Replies

Google says...

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"

I say...

Don't use Borland. There are far better completely free alternatives.

Google says...

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"

I say...

Don't use Borland. There are far better completely free alternatives.

I already read that, but I only have .cpp and .h files. But I could see that the problem is when is linking the .h, I changed the extension to .hpp but did not work..

Anyway wich other compiler do you recommend ??

vc++ 2010 Express and Code::Blocks are both good, free compilers and IDEs.

There are many different free C++ compilers around, with the two most commonly used free ones being GCC and Visual C++ Express.

VC++ Express is a compiler and IDE (integrated development environment), and has an excellent debugger, but you have to be careful about Microsoft-specific extensions if you intend to write portable code.

GCC is the GNU C++ compiler used in Linux, but has ports to all of the major operating systems including Windows and MacOS. By itself, GCC is just a command-line compiler, but it includes any number of tools with it, and there are several IDEs which use it, with the best probably being Code::Blocks. The debugger that comes with it is a lot less useful than that with VC++ Express, but the rest of it is more than equal to the MS package.

I should add that the version of Borland C++ you're using is also rather dated; Borland itself is now called Embarcadero Technologies, and the current version of their compiler (and IDE) is called "C++ Builder XE". It is not free, and unless you have a specific need for it, probably not worth the money.

Ok so much thanks to everyone.. I already solve that problem.. but when I'm linking I receive a lot of warnings like this : Public symbol 'stream_clientes' defined in both module *****.obj and ****.obj and the why I'm using Borland is because of my teacher wants to teach my class how to compile/linking just using a CLI compiler and notepad without IDEs,so if anyone of you can help me??, I think the problem is with the files streams, gives me a lot of warnings with that, but I'll try a diferent compiler too.. so much thanks for your time

One way that will happen is if you declare some object in a *.h (header) file then include that file in two or more *.c or *.cpp files. You have to use the extern keyword in the header file to prevent that, then you will have to declare it again without extern in one of the *.c or *.cpp files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.