CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2001
    Posts
    745

    To avoid compiling a File

    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

  2. #2
    Join Date
    Oct 2001
    Location
    India
    Posts
    145

    Thumbs up

    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

  3. #3
    Join Date
    Oct 2001
    Posts
    745
    Thanks! That was a good Point..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured