VC++ needs /TP to build dbg-but rel fails

Microsoft Visual studio v6.0 enterprise...
September 21, 2009 at 09:16:12
Specs: Windows XP, 2GB
As I have a mix of C and C++ files I needed /TP compiler option on VC++ to build the debug configuration as it didn't like the 'namespace' keyword - this option fixed all the build errors. However it still fails to build under the release configuration - it still fails at the 'namespace' key word which results in hundreds of errors.
Are other compiler options needed ?

See More: VC++ needs /TP to build dbg-but rel fails

Report •

September 21, 2009 at 09:56:36
You probably specified /TP only in the Debug configuration.

In any case, the proper fix is to give your filenames the correct extension. Why do you have C++ source files that don't have a .cpp extension?

Report •

September 22, 2009 at 01:36:36
I have a mixture of c and cpp files. They all have the correct extension. /TP is defined in the release build.

Report •

September 22, 2009 at 02:36:55
If they all had the correct extension, then you would have .C files for pure C code (no C++ inside) and .CPP files with C++ code. Any .h header files included by .C files will also have pure C (not C++) code. If that was the case, you would not need the /TP flag, and all your code would compile with no errors.

Also, even for an application that is written in a mixture of C and C++, you don't have to compile all code as C++. Just compile your C code as C, and your C++ code as C++. But make sure main() is in C++. Then link all your .obj files together into an executable.

Report •

Related Solutions

Ask Question