Thread: #if defined...

  1. #1
    Unregistered
    Guest

    #if defined...

    how does the #if defined command work?

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    well, it's look at during compilation.. and things are included or excluded depending on the result of the #if statement.

    eg:

    char name[] = "Uraldor";

    #ifdef WIN32
    MessageBox(NULL, name, "Hello", MB_OK);
    #else
    cout << "Hello Uraldor\n";
    #endif

    or maybe

    #ifdef _DEBUG
    printf("Error: %s\n", currentString);
    #endif

    these are not good examples, but you should get the idea

    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking problems in Visual Studio
    By h3ro in forum C++ Programming
    Replies: 5
    Last Post: 03-04-2008, 02:39 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Variables already defined while linking.
    By xconspirisist in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2005, 05:20 AM
  4. DLL compiling question
    By Noose in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2004, 07:16 AM
  5. Header files
    By borland_man in forum C++ Programming
    Replies: 14
    Last Post: 02-22-2002, 04:30 AM