Search code examples
winapivisual-c++static-libraries

vc++ 2010 add compiler switch


I am trying to build a library (first time i ever tried that) and the instructions in the documentation are enough for someone who understands how but not for noobs like me.

Here is the what the documentation says " To create a library do the following minimum steps:

  • create a “Win32 static library” called “library”,

  • add all source files into this project,

  • add the symbol “TETLIBRARY” to compile switches.

  • build the project. "

Ok, I done the first 2 bullet points. There are only 3 source files and I added them. creating a win32 static lib was easy enough. I have spent the last half hour / fourty-five minutes searching for how to "add a compile switch" and closest I got was adding "TETLIBRARY" to command line in properties and that just returned a "no such file" error

So my question to you lovable square-eyed eggheads is: How do I add the symbol “TETLIBRARY” to compile switches."?


Solution

  • I assume it means define TETLIBRARY as a preprocessor symbol. To do this:

    Open the Project Properties. Select "All Configurations" in the Configurations drop-down list (at the top left of the dialog). The navigate to:

    Configuration Properties | C/C++ | Preprocessor

    You should see something like:

    Preprocessor Definitions: WIN32;<different options>

    Change this to:

    Preprocessor Definitions: TETLIBRARY;WIN32;<different options>

    Close the dialog. You are done.

    The <different options> refer to the Debug and Release build options. If you go back into the dialog you should see that TETLIBRARY is defined for both builds.