|
| rootboy (10) | |||
So when I try to compile my project, I get the following warning and errors: c:\...\main.cpp(51) : warning C4003: not enough actual parameters for macro 'max' c:\...\main.cpp(51) : error C2589: '(' : illegal token on right side of '::' c:\...\main.cpp(51) : error C2143: syntax error : missing ')' before '::' c:\...\main.cpp(51) : error C2059: syntax error : ')' (Because of me trimming my code to show the problem, the actual line number for these errors is now 21). I included "cin.ignore(numeric_limits<streamsize>::max(), '\n');" because of getting errors that wouldn't clear in cin. It works as expected when used without the "cls" function. If I don't include the function to clear the screen (cls) then everything works fine. Using "Using namespace std;" or not (and in that case, prepending my cin, cout, etc with std::) makes no difference whatsoever. Sure, I could use a system call, but I'd rather not get into bad habits this early on (I'll wait until my boss gives me a deadline :lol: ). For now, I'm learning this on my own just for my own edification, so there's no pressure on me to get it working right away. Besides, I spend most of my time in linux, so I'd be much better off learning how to do things "The Right Way" rather than use OS specific shortcuts. Is this a VC++ Express Edition issue? I've read where windows.h wasn't included with the free edition. Should I be using a different IDE/Compiler? Thanks guys! | |||
| Bazzy (4111) | |||
Windows declares lots of macros, one of them is 'max' which will replace 'max' in numeric_limits<streamsize>::max().To remove that macro, add these lines after #including <windows.h>:
| |||
| kbw (1505) | |||
While you're at it, do the same for min. They're hangovers from a more primitive age.
| |||
| Zhuge (633) | |
Those ideas both work, but the way that I think you ought to do it is #define NOMINMAX , as this is the define that the file checks to see whether it should define those macros in the first place. | |
| rootboy (10) | |
| Perfect! Thanks guys, that worked like a charm. :) | |
This topic is archived - New replies not allowed.
