IDE liking

This is a discussion on IDE liking within the General Discussions forums, part of the Community Boards category; Originally Posted by cpjust Then you'd be relying on that always being in the preprocessor section of the project settings. ...

  1. #46
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,632
    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>?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,543
    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
    Portugal
    Posts
    7,438
    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.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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.

Page 4 of 4 FirstFirst 1234
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, 06: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, 09: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, 07:53 PM

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