Jump to content
  • Advertisement
Sign in to follow this  
TheGuyOnTheCouch

Noobie Help

This topic is 4728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, so I've recently decided to get into game programming (knowing that for the last year i have studied computer hardware nonstop :)) So, i picked up Johnathan S. Harbour's "Beginning Game Programming". I got to the first part, making the a HelloWorld program to display a dialog box. The program is suppose to be written in C, making a new project and new source code using Bloodshed Dev-C++ (came free with book). I entered the code in the book to make the dialog box which is: // Beginning Game Programming // Chapter 2 // HelloWorld program #include <windows.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { MessageBox(NULL, "All your base are belong to us!", "Hello World", MB_OK | MB_ICONEXCLAMATION); } Well when i type that in, click compile and run, it doesn't work. Any ideas? TY in advance.

Share this post


Link to post
Share on other sites
Advertisement
Did you accidentally make your project a c++ project rather than a regular C project? Did you include it in a project? What errors did it give, most importantly? You aren't being very clear, sorry.

Share this post


Link to post
Share on other sites
Ok, sry about that, i made sure i started a new empty project, started a new source code file, in c, typed everything in, and clicked compile/run and my compile log is saying:
Compiler: Default Compiler
Building Makefile: "C:\Dev-Cpp\Projects\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Projects\Makefile.win" all
Execution Terminated

Does that help any?

Share this post


Link to post
Share on other sites
ooohhh... interesting. Not much help there :) You aren't compiling from a school computer/non windows computer, are you? I've had something similar happen from school, and it works from home.

You might try making a c++ project - it should fully support anything in the C program, and might work better for you. I do more C++ than anything, and never really use actual C.

Share this post


Link to post
Share on other sites
are you using the version of dev-cpp in the book? If you are, try downloading the latest version from their website. Get the latest version. If that doesn't work, then try this code to make sure you don't have any serious problems with life or the universe.


#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Goodbye, cruel world!", "Note", MB_OK);
return 0;
}



If that doesn't work, then you have failed. Reincarnate and start over :)

Share this post


Link to post
Share on other sites
hmm, still didn't work, and i can't come back to life for some odd reason...hmm, that's a mystery! :)
did it work for u?
i even copy and pasted.
and is that a screenshot?
my int and return turn bold, not blue...

Share this post


Link to post
Share on other sites
not a screenshot, otherwise either you have discovered some secret and revolutionary new technology built in to dev-cpp, or you couldn't have pasted it in ;) Thats just how gamedev does syntax highliting.

Is this your computer? Did you install it, and the OS yourself? Does it have any additional security stuff on it?

Test this code (don't put it in a project, just make a file "main.cpp" and hit F9):

int main()
{
return 0;
}

Have you done any programming before?

Share this post


Link to post
Share on other sites
Quote:
Original post by silverphyre673
are you using the version of dev-cpp in the book? If you are, try downloading the latest version from their website. Get the latest version. If that doesn't work, then try this code to make sure you don't have any serious problems with life or the universe.

Going off this suggestion which you already have done...
Did you try:
1. Uninstall
2.Delete Dev-Cpp folder
3. Reinstall

Mine was screwed up and installing over the old files didn't help. I deleted the Dev-Cpp folder before I reinstalled and everything was back to normal.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!