Thread: IDE liking

  1. #46
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by cpjust
    Then you'd be relying on that always being in the preprocessor section of the project settings. If you lose the project settings or switch to a different compiler, you'll get the error again. If you put the #undef in the source file you won't have to worry about it happening again (and newbies reading your code long after you're gone can learn about that problem with the windows header file -- and hopefully you commented why the #undef is there).
    What about conditionally defining NO_MIN_MAX before each #include of <windows.h>?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #47
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by laserlight View Post
    What about conditionally defining NO_MIN_MAX before each #include of <windows.h>?
    I guess that would work too. I just never heard of NO_MIN_MAX until now.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  3. #48
    Registered User UltraKing227's Avatar
    Join Date
    Jan 2010
    Location
    USA, New york
    Posts
    123
    i even dont know what NO_MIN_MAX is!
    i gotta learn this too....

  4. #49
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It's a define that tells the Windows headers to not define min and max.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #50
    Registered User UltraKing227's Avatar
    Join Date
    Jan 2010
    Location
    USA, New york
    Posts
    123
    thanks for telling me!

  6. #51
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Are there other macros in <windows.h> that conflict with functions other than min & max? If so, are there #defines for them as well? Is there a list of all the macros you can define to undefine the bad macros?
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  7. #52
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Ugh! Too many if you are unlucky enough.

    The trick is to always include windows.h last. Most headers have the needed code already to fix the conflicts. This is true of windows own headers (winsock2.h for instance which has a series of conflicts with windows.h because someone though it would be important for windows.h to include winsock.h) and third-party libraries which have more experience about it than Microsoft itself.

    min-max type of conflict is one of a kind however. At least to my knowledge there's no other conflict with std:: names.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. IDE
    By djnorthyy in forum C++ Programming
    Replies: 6
    Last Post: 03-31-2008, 11:56 AM
  2. CBoard IDE of the year
    By cboard_member in forum A Brief History of Cprogramming.com
    Replies: 30
    Last Post: 12-09-2005, 07:50 AM
  3. 2 hdd, 1 ide
    By ElubHsif in forum Tech Board
    Replies: 6
    Last Post: 06-12-2005, 11:44 AM
  4. motherboard has 2 IDE socket?
    By beely in forum Tech Board
    Replies: 16
    Last Post: 10-30-2002, 10:55 PM
  5. HD on IDE 2
    By W.Churchill in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 03-13-2002, 08:53 PM