-
Well, what I always do with projects that have more than one file, is clock the compile button farthest to the right. It's the one with four litle grey boxes arraynged in a bigger box. That will compiler every single file in your project. Then click the second button, the appplication window, to run it.
Oh, and you have changed your project type from "Win32 Console" to "Win32 GUI" Right? If not, that might be part of your project. You change your project type in Project Options, on the first tab.
-
I checked and it was a GUI file. As for the compiling, I did click it then the run and it still doesn't work...it says project is not compiled. I compile each tab then run the source code right? thx l8er
-fire
-
1 Attachment(s)
You want to click the rebuild all button. It will compile all your stuff and link them.
-
Well, if you select any of the files that are in your project, (by tab I mean) and you click the fourth button like I said, all three files should be compiled.
So, you're saying you're not getting any compilation errors, but it's still saying your code isn't compiled? Hmm...... Could you get me a screenshot of the window that appears once you click that fourth button I mentioned? If it disappears, there's an option to keep it from doing so somewhere, but I forget where.....pooie.
-
yea that is what i have been clicking... i opened the file that theForger made to download and it works fine. Although he has 1 extra .c file in his project. I copied the file and added it as a .c file into my program and it still says it doesn't compile. Im so confused :(...-edit- I opened the .c file that he provided just by itself and saved the others for that project in the same folder an it worked :) . Don't really understand why it would work with his and not mine(copied it). Will do some more experimenting of why this occured and then get back to the tutorial. Why was it a c file and not a cpp file? Could that have been the reason? thx l8er
-fire
-
Well, .c is the suffix for C based programs. C++ programs use the .cpp suffix. C and C++ are incredibly similar, but classes are not the only difference. There are many minute syntax differences and the like. Maybe you just happened to have one of those in the file.
Now, I kinda doubt that that was the problem. I remember, I tried to use one of theForger's tutorials with my project language set to C++ and I got the wierdest errors.
I'd say the .c and .cpp thing definately had something to do with it. What really happened? I haven't the slightest clue. The Dev C++ is wierd.
-
any alternatives that will work instead of Dev C++, I think I will stick with Win32 for now since I am trying to make a schematic drawing program. Thats for a diff time though, gotta really understand the languages 1st. Doesn't Dev C++ have a choice between C and C++? Would that do the trick? thx l8er
-fire
-
Yeah. When you first create a project, you have the option of selecting a language. I don't know if you can change the language later on, but I've looked quite a bit and haven't found anything. At any rate, I use C in all my programs and don't have too many problems.
I'll tell you what, though. In the past, I've had really wierd problems. What I did was close Dev C++, go into the project's folder and delete the project's files. NOT the code files. Only the files generated by Dev C++ ( .dev, anything with the word private in the name, and anything called Makefile). Then I open up Dev C++ again and create a completely new project. Then I just add my code files (.c, .h, .rc, etc.) and compiler again. I don't quite get why sometimes, but it usually works fine. Try that.
-
If a window flashes up, then it sounds like it has compiled. Do you know how to use a debugger??? Coz now's a good time to start learning ;)
-
Yeah. And if not, a really easy way to debug, although it's not really as effective in some cases, is to simply install some Message Boxes at certain points and give them meaningful text. You're using theForgers tutorial, so there should be a piece of code after your window registration that looks something like this.
Code:
if(!RegisterWindowClass(&wc))
{
MessageBox(hwnd, "Window class registration failed.", "Error:", MB_ICONERROR | MB_OK);
}
This means that if something fails in your registration, a messsage box will appear to tell you so. A good way to debug this would be to add in an else.
Code:
if(!RegisterWindowClass(&wc))
{
MessageBox(hwnd, "Window class registration failed.", "Error:", MB_ICONERROR | MB_OK);
}
else
{
MessageBox(hwnd, "Window class registration successful.", "Debug:", MB_ICONINFORMATION | MB_OK);
}
If a message box never appears, it could be a sign that your project isn't compiling after all. But to really test this, you would do this.
Code:
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow)
{
MessageBox(NULL, "Program beginning...", "Debug:", MB_ICONINFORMATION | MB_OK);
//Rest of code.....
If you never get a message box, either you can't argue NULL to a Message Box like I did, which you should be able to, or you program isn't compiling, or it isn't running.