#if defined...

This is a discussion on #if defined... within the C++ Programming forums, part of the General Programming Boards category; how does the #if defined command work?...

  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, 07:39 AM
  3. Variables already defined while linking.
    By xconspirisist in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2005, 06: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21