Computing.Net > Forums > Programming > VC++ needs /TP to build dbg-but rel fails

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

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

Reply to Message Icon

Name: adetheheat
Date: September 21, 2009 at 09:16:12 Pacific
OS: Windows XP
CPU/Ram: 2GB
Product: Microsoft Visual studio v6.0 enterprise edition
Subcategory: C/C++
Comment:

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 ?



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: September 21, 2009 at 09:56:36 Pacific
Reply:

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?


0

Response Number 2
Name: adetheheat
Date: September 22, 2009 at 01:36:36 Pacific
Reply:

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


0

Response Number 3
Name: klint
Date: September 22, 2009 at 02:36:55 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


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

How to build an E-Card website? www.computing.net/answers/programming/how-to-build-an-ecard-website/3637.html

Unable to Build in VisualStudio.Net www.computing.net/answers/programming/unable-to-build-in-visualstudionet/6582.html

needs help to re install AIM www.computing.net/answers/programming/needs-help-to-re-install-aim/8613.html