Sunday, August 2, 2009

HELP! I have got a C++ code and when I compile I get theses errors?

Line 111 - Unit key.cpp - VK_OEM_4` undeclared (first use this function)





Please tell me what to do??

HELP! I have got a C++ code and when I compile I get theses errors?
You are missing some required header file that you need to #include. Alternatively, you could add the following #defines yourself to your own code so that iut does not need to depend on any other file to get what it means:





===============================


#ifndef VK_OEM_1


#define VK_OEM_1 0xBA


#endif


#ifndef VK_OEM_2


#define VK_OEM_2 0xBF


#endif


#ifndef VK_OEM_3


#define VK_OEM_3 0xC0


#endif


#ifndef VK_OEM_4


#define VK_OEM_4 0xDB


#endif


#ifndef VK_OEM_5


#define VK_OEM_5 0xDC


#endif


#ifndef VK_OEM_6


#define VK_OEM_6 0xDD


#endif


#ifndef VK_OEM_7


#define VK_OEM_7 0xDE


#endif


#ifndef VK_OEM_8


#define VK_OEM_8 0xDF


#endif


===============================





However, this does not guarantee that once this error is gone, you won't get other errors. This solution is for this particluar error, and does not guarantee error-free compilation, if you know what I mean. I mean that if this solves your error, give me 10 points even if you get other errors :-)





UPDATE: Another webpage seems to have an answer as to which exact file you need to #include: looks like adding





#pragma comment(lib, "user32.lib")





or





#include %26lt;Winuser.h%26gt;





might solve your problem. Look here:


http://www.gamerzplanet.net/forums/warcr...
Reply:It means you tried to use a variable you didn't declare yet. Either you forgot to include a header file that declares it (like an external library, for example), or you misspelled the variable's name.
Reply:If that is a copy and past of the error, did you accidentally add a "`" to the end of the variable name. I don't believe that is a normal part of the error.
Reply:#define VK_OEM_4 VK_OEM + 4





... it's a custom variable, or pre-processor macro .. without code or details isn't possible to answer to your question!
Reply:IT looks like there should be a declared value in VK_OEM_4 but there isn't, step threw the code and see it there is a value being place into it.
Reply:Like the others have said the compiler is complaining that VK_OEM_4 is undeclared. VK_OEM_4 does not seem like the name of a variable that you would normally just declare/use yourself, so I did a search and it looks like it is a Windows GUI value. I have not done much with windows programming, but it appears to be a key code value. You can probably find more about it at MSDN.

sepal

No comments:

Post a Comment