Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to specify cpp files

Status
Not open for further replies.

redoctober

Programmer
Oct 25, 2000
37
CA
Hi,
I have a project that is being developed for different platforms. So i have a common interface (.h files) but the implementation (.cpp files) varies for each platrom and those files are kept in different directories. How can i specify in MSVC++ 2003 project to take proper cpp files and compile them.

Thanks.
 
Usually most of the code is the same except for the platform specific functions, so people usually keep one version of .cpp files and use #ifdef directives like this:
Code:
// Some code that works on every platform...

#ifdef WIN32
   // Put Windows specific code here.
#elif defined( LINUX )
   // Put Linux specific code here.
#elif defined( SOLARIS )
   // Put Solaris specific code here.
#endif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top