CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Preprocessor directive for the whole solution

    I'm building an audio application. It can be built (optionally) with support for Steinberg's VST plugin architecture. To build with VST support I just need to define the preprocessor directive VST_SUPPORT.

    The solution has around 20 projects so it's a bit of a pain to modify them all to either add or remove the VST_SUPPORT directive. I know I can select all 20 projects simultaneously and do them all together but I just wondered if there's a more elegant way - something like a preprocessor directive that I could apply to the top level solution which would then get inherited by every project?
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Preprocessor directive for the whole solution

    I think property sheets is what you need http://stackoverflow.com/questions/3...-in-a-solution
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: Preprocessor directive for the whole solution

    Thanks. Another idea occurred to me (I don't know why I didn't think of this before) but all these modules use the compiler option "/FI" (force include) to force the incusion of a specific header file. At the moment it's needed to guarantee that all our devs will be linking to the same 'C' runtime version. I could probably use a similar approach for adding VST support. However, it depends on when the specified header gets force-incuded. I'm assuming it'll get included before any other headers. Hope that's a safe assumption!
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Preprocessor directive for the whole solution

    Project / Properties / Configuration Properties / C C++ / Preprocessor / Preprocessor definitions.

    Command line switch /D

  5. #5
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: Preprocessor directive for the whole solution

    Wouldn't I need to do that for every project? I'm looking for a solution that I can apply in a single place.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  6. #6
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Preprocessor directive for the whole solution

    The force include solution is probably easier. For both solutions you need to have different settings for different targets but since the force include already are at place you at least don't have to add edit all targets.

    Here's what the help say about it:
    This option has the same effect as specifying the file with double quotation marks in an #include directive on the first line of every source file specified on the command line, in the CL environment variable, or in a command file. If you use multiple /FI options, files are included in the order they are processed by CL.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

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