Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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 ?

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?

I have a mixture of c and cpp files. They all have the correct extension. /TP is defined in the release build.

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.

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |