I have never paid attention to this problem before. I have logged out and completed the cancellation. Until today...
I paid the price of an afternoon project progress bubble, so I plan to write it out. Although this will further make the project progress bubble, it is worth thinking about saving more afternoon projects that may be ruined :)
The problem is also quite simple: Using MessageBox results in the Code hosting C ++ won't pass compilation. My code is like this: MessageBox: Show ("oh, my god! ");
Compilation error: Error c2653: "messageboxa": not a class or namespace name
Rely on me! Isn't this code that raped me? I declared MessageBox, which was forcibly replaced with messageboxa and said it was my fault :(
Of course, I declare the system: Windows: Forms namespace. What's more strange is that I declare it under. H of the same project.
MessageBox: Show ("oh, my god! ");
The result is successfully passed... Completely speechless!
A burst of crazy searches on the Internet (this is why I had a bath in the afternoon). I only learned one thing: Maybe it is a problem caused by C macro. In addition, I also listened to a lot of opinions on the right and right of the C macro, and did not help solve the problem at all.
Almost in despair, I decided to try msdn again, using messageboxa to search:
...
// ================================================ ========================================================== ================
Even if I have a namespace, why do I still get the error message "messageboxa is not a 'system: Windows: forms' member?
This indicates that the Preprocessor only performs text replacement, ignoring the fact that MessageBox is part of the system: Windows: Forms namespace .. NET framework does not include a class named messageboxa, so the compiler generates an error. To solve this problem, you can use # UNDEF to prevent name conflicts, as shown below.
# Include <windows. h>
# Using <mscorlib. dll>
# Using <system. Windows. Forms. dll>
# Ifdef MessageBox
# UNDEF MessageBox
# Endif
Int main ()
{
System: Windows: forms: MessageBox: Show ("Hello, world! ");
}
// ================================================ ========================================================== ================
Ms clear answer, I looked at the dark sky outside the window, ready to cry without tears...
In actual use, you only need to declare # UNDEF MessageBox before the main function starts.
:)
[WQL]