I picked up the Course Tech Cenage Beginning Game Programming 3 Edition and the first bit of coding it shows is Hello World. I've tried getting it to run multiple times but no luck.
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR 1pCmdLine, int nShowCmd)
{
MessageBox(NULL, "I'm trying hard to get this to work",
"This box right here, son", MB_OK | MB_ICONEXCLATION);
}
----
It'll likely work if you go into project properties and change the character set from UNICODE to either of the other two choices. Also, make sure its set up as a Win32 GUI project.
Yeah, I changed it from UNICODE to Multi-Byte but still no luck
It says:
Command line error D8016 : '/GL' and '/ZI' command-line options are incompatible
...in the output but I don't know what that means. I might just continue on with whats next but this is gonna bother me to no end. The book says I need to convert the project to ANSI but seriously doesn't tell me how.
"Open the project menu and choose HelloWorld Properties option to bring up the Project Properties dialog.
After closing the dialog, try running the program again by pressing the F5 key. You should be rewarded with a message box."
That's what the book says. Looks like it completely left a step out or I'm missing something. I figured out changing from UNICODE by looking at a figure in the book but besides that it doesn't explain what ANSI is or how I convert the project to it.
That's funny. That should have fixed it. The default character set setting for Visual Studio has been wide character for a number of versions.
Maybe try deleting the whole project (directories and all) and starting over. Tomorrow if you have'nt got it working I'll give you a detailed step by step instruction as I have Visual Studio 2008 too.
Also, WinMain() is supposed to return an int, and the code above doesn't show that. I'm a stickler about stuff like that. Not likely your problem, but thought I'd mention it.
The problem is you or somebody misspelled MB_ICONEXCLAMATION. I went through all these instructions to show you how to correctly start a new Win32 project, and then mine didn't work either!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
1) Open Visual Studio;
2) Click on Create: Project;
3) Choose for Project Types 'Visual C++', 'Win32';
4) Fill in 'name' in 'New Project' dialog;
5) In the 'Win32 Application Wizard' click 'Application Settings';
6) Check the Radio Button 'Windows Application' and 'Empty Project';
7) Click Finish;
8) In 'Solution Explorer' right click on the name of your project and
from the context sensitive menu choose 'Add >>> New Item';
9) From the 'Add New Item' dialog highlight and choose 'C++ File' and
fill in Main.cpp in dialog for name;
I finally tracked the problem down to the mis-spelling of ICON_EXCLAMATION. Here's my program without changing from the default UNICODE...
1 2 3 4 5 6 7
#include <windows.h>
int WINAPI WinMain(HINSTANCE hIns, HINSTANCE hPrevIns, LPSTR lpszArgument, int iShow)
{
MessageBoxA(NULL, "I'm trying hard to get this to work","This box right here, son", MB_OK | MB_ICONEXCLAMATION);
return 0;
}
Could somebody tell me the correct spelling of misspelling???? That doesn't look right to me.
I did misspell ICON_EXCLAMATION in my original post but I tried again making sure I did everything in the book the way it says but it still didn't come out right. Though your code worked perfectly. It has to be something simple I'm messing up. I've gotta head to work but I'm gonna look over your code and the books code afterwards. Thanks for the help.