Click to See Complete Forum and Search --> : To avoid compiling a File


Kohinoor24
May 29th, 2002, 01:57 AM
I have a project with these 2 classes & separate .cpp files for the function declarations.

#include<pthread.h>
class LinuxThread
{
public:
// Function Declarations
private:
pthread_t ThreadHandle;
}



#include <windows.h>
class WinThread
{
public:
// Function Declarations
private:
HANDLE ThreadHandle;

}



I have a "Reader" & "Writer" class also Which derives from either the "WinThread" class or "LinuxThread" class depending on the operating system.This Iam managing in my main() with #ifdef procedure

In my main() Function

I have the #ifdef declarations:

#ifdef _LINUX_

#endif

#ifdef _WIN_VER
#endif

I Have all these Linux specific files & windows specific files in a single project.My question is there any way,apart from #ifdef statements, by which I can compile & built the project without errors under windows or Linux without the winspecific files or Linux specific files causing errors.

ie:when Iam compiling this project under windows,I need some way so that Linux specific files doesnt get compiled & vice versa.
I dont want to use #ifdef statements ,because I have used it once in my project(In main()) & I dont want to use it more than once

Thanks

muthu555
May 29th, 2002, 06:11 AM
hi,
Well i am not sure as to what dev enviroment u r using.If u r using VC, then u can go tto project settings and choose the partifular file,on the right hand side u would have a checkbox which says "Exclude from build" and that particular file would be excluded from the build.

hope it helps.
Regards
Muthu

Kohinoor24
May 29th, 2002, 06:27 AM
Thanks! That was a good Point..