DevC++ / VC6 :: WinMain() Hell?
-
- Posts: 36
- Joined: Fri Feb 20, 2004 9:23 am
- Contact:
DevC++ / VC6 :: WinMain() Hell?
Hi all,
I'm a newbie to Irrlicht (and a bit of a newb to C++ too ), but I'm going mad here! I want to make a Win32 application for the HelloWorld Irrlicht example, but it's all going horribly wrong.
After searching through the forums, the basic suggestions were to simply replace main() with WinMain(), but I've been battling with DevC++ for hours trying to get this working. It compliled relatively simply, but every time I run it - it immediatley closes again!? I can't debug it as it seems to close before the debugger will catch anything.
Imagine my surprise when I copied the code into Visual C++ 6 (after creating a similar project with all the Irrlicht libs setup etc) and HEY PRESTO it works with no probs!
Please can someone put me outta my stupidity and tell me what I'm doing wrong with DevC++!? I would prefer to use it over M$oftVC++ as I wanna give it a chance.
Cheers in advance for any help!?
Paul.
I'm a newbie to Irrlicht (and a bit of a newb to C++ too ), but I'm going mad here! I want to make a Win32 application for the HelloWorld Irrlicht example, but it's all going horribly wrong.
After searching through the forums, the basic suggestions were to simply replace main() with WinMain(), but I've been battling with DevC++ for hours trying to get this working. It compliled relatively simply, but every time I run it - it immediatley closes again!? I can't debug it as it seems to close before the debugger will catch anything.
Imagine my surprise when I copied the code into Visual C++ 6 (after creating a similar project with all the Irrlicht libs setup etc) and HEY PRESTO it works with no probs!
Please can someone put me outta my stupidity and tell me what I'm doing wrong with DevC++!? I would prefer to use it over M$oftVC++ as I wanna give it a chance.
Cheers in advance for any help!?
Paul.
-
- Posts: 360
- Joined: Tue Feb 10, 2004 2:20 am
- Location: Lubbock, TX
Try This:
Also you need to make sure and chose a WinMain() application if you are using dev C++ 4 and if you are using Dev C++ 5 choose a Windows Application Project
Code: Select all
include <window.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
//You code that would normally be in the main() function
}
-
- Posts: 36
- Joined: Fri Feb 20, 2004 9:23 am
- Contact:
Thanks, but still doesn't work
Thanks thesmileman, but it still compiles, runs, then nothing happens (immediatly closes before it actually ran?!)
I'm starting to think now that the code is correct (including the code you kindly supplied me), but that somehow DevC++ is incorrectly configured?
When I just create a Windows Application Project (in DevC++ 5), it compiles, runs, and gives me a nice little empty Win32 window. As soon as replace the code inside WinMain() with the one from the HelloWorld Irrlicht example - it does the same thing again: runs, but closes without actually displaying a window.
Does this ring any alarm bells with anyone as to why this might be happening? I can almost guarentee that if I copy the code into a VS6 project again, it'll probably work like a charm.
I'll still battle with it in the meantime - its gotta be something silly...
I'm starting to think now that the code is correct (including the code you kindly supplied me), but that somehow DevC++ is incorrectly configured?
When I just create a Windows Application Project (in DevC++ 5), it compiles, runs, and gives me a nice little empty Win32 window. As soon as replace the code inside WinMain() with the one from the HelloWorld Irrlicht example - it does the same thing again: runs, but closes without actually displaying a window.
Does this ring any alarm bells with anyone as to why this might be happening? I can almost guarentee that if I copy the code into a VS6 project again, it'll probably work like a charm.
I'll still battle with it in the meantime - its gotta be something silly...
Post your code, there might be something wrong with it if you did modify it. I've had many similar crashes and they were all from stupid mistakes. One of the crashes was caused by it not finding a file . Pretty Annoying.
________
Alternative medicine forums
________
Alternative medicine forums
Last edited by disanti on Tue Feb 22, 2011 8:02 am, edited 1 time in total.
-
- Posts: 360
- Joined: Tue Feb 10, 2004 2:20 am
- Location: Lubbock, TX
I would recommend trying to get sample code from the web for a basic windows application and see if it will work. This will confirm or deny whether it is a problem in Dev C++ or with the windows verison of the code.
I know it is not what you want but since you said you are a newbie you might try using just a main() instead of a winmain(). I still just use main() just cause I don't care about the dos window in the background.
Also you might post your code as disanti suggested
I know it is not what you want but since you said you are a newbie you might try using just a main() instead of a winmain(). I still just use main() just cause I don't care about the dos window in the background.
Also you might post your code as disanti suggested
If you're a little newbie with C++ and have access to MSVC then use it. And don't be so rude to call it M$ cause anyway atleast it's the best Development Environment for C++ today.
BTW, you don't give any chance o DevC++ by using it instead of MSVC cause they are not even competitiors and never will
I've never seen a man who spent at least 100$ for one product and then prefer to use a free one
BTW, you don't give any chance o DevC++ by using it instead of MSVC cause they are not even competitiors and never will
I've never seen a man who spent at least 100$ for one product and then prefer to use a free one
there is another guest...
-
- Posts: 36
- Joined: Fri Feb 20, 2004 9:23 am
- Contact:
Well excuse me!
Ok,
First off, Guest:
To all: Sorry I got bogged down in all that. Thank you for all your replies. I will go and have another "crack at it" and see what happens. If still no joy, then I may post the code. In the meantime - if anyone knows whats going wrong here - please let me know!
Many thanks again,
Paul
First off, Guest:
"Ouch!". I don't want this discussion to turn into a flaming war, so I will just say: "Fair nuff, each to their own". But please remember that you no nothing about me. You can clearly see that I'm evaluating both programs. Regardless of what you may believe, I fell that "free" projects such as DevXC++ require all the support they can receive. Therefore, although (currently) MS VC++ works where DevXC++ doesn't, I refuse to simply "go with" VC++; simply for the fact that there is tons more facilitys to customise the IDE to your liking. It may sound sad, but to some people - that's importantAnd don't be so rude to call it M$
To all: Sorry I got bogged down in all that. Thank you for all your replies. I will go and have another "crack at it" and see what happens. If still no joy, then I may post the code. In the meantime - if anyone knows whats going wrong here - please let me know!
Many thanks again,
Paul
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
I don't really know what I need to have in the Dev-CPP code to work. I added the WinMain() function. But that doesn't help. Do I need to have the window creation and callback function also?
[Linker error] undefined reference to `_imp___ZN3irr12createDeviceENS_5video11EDriverTypeERKNS_4core11dimension2dIiEEjbbPNS_14IEventReceiverEPKw'
This is the link error I get.
Thanks
[Linker error] undefined reference to `_imp___ZN3irr12createDeviceENS_5video11EDriverTypeERKNS_4core11dimension2dIiEEjbbPNS_14IEventReceiverEPKw'
This is the link error I get.
Thanks
Ok
2Liquidream:
Couple advices to a great supplier (really, no offence)
What I would do in such situation
1. I'm pretty sure that your program's entry point is not WinMain function, but you can debug it (set breakpoint in the very beginning of your WinMain function and check if program goes there)
2.1. If I'm right and your program doesn't go there - consult to the huge community of free DevC++ users and ask them for support: get some manuals about linker using there, specify linker option (such as /ENTRY in VC++ linker) to point to your WinMain function.
2.2. If I'm wrong - say "HEY! I knew he was stupid!" and continue debugging
Nothing personal, I just use what works better - quite simple. You just need to be honest to yourself: do you need working project or supply DevC++?
2exal:
Your suggestions have nothing common with your error. Your error says that linker cannot find implementation of createDevice function in object files that your compiler have created. So read release 0.5 notes for DevC++ users. People say that there is something inetersting there All I can say that I can see a .def file with Irrlicht library there...
2Liquidream:
Couple advices to a great supplier (really, no offence)
What I would do in such situation
1. I'm pretty sure that your program's entry point is not WinMain function, but you can debug it (set breakpoint in the very beginning of your WinMain function and check if program goes there)
2.1. If I'm right and your program doesn't go there - consult to the huge community of free DevC++ users and ask them for support: get some manuals about linker using there, specify linker option (such as /ENTRY in VC++ linker) to point to your WinMain function.
2.2. If I'm wrong - say "HEY! I knew he was stupid!" and continue debugging
Nothing personal, I just use what works better - quite simple. You just need to be honest to yourself: do you need working project or supply DevC++?
2exal:
Your suggestions have nothing common with your error. Your error says that linker cannot find implementation of createDevice function in object files that your compiler have created. So read release 0.5 notes for DevC++ users. People say that there is something inetersting there All I can say that I can see a .def file with Irrlicht library there...
Last edited by Guest on Tue Feb 24, 2004 1:19 pm, edited 1 time in total.
there is another guest...
-
- Posts: 36
- Joined: Fri Feb 20, 2004 9:23 am
- Contact:
-
- Posts: 271
- Joined: Sat Aug 23, 2003 5:52 pm
- Location: Hurricane Central, Florida
You do not need a callback, Irrlicht already has one embedded in it. Just make sure that you created a win32 application and not a console app and make your WinMain look like this...
If that doesn't work, well... Dev C++ SUKS, MICROSOFT RULES
Code: Select all
#include <windows.h>
#include <windowsx.h>
.
.
.
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, INT ncmdshow){
.
.
.
um... its actually a LOT easier than what you guys have all been trying.
1) use int main()
2) go to project settings and choose GUI instead of Console
If you look at ICE or IrrLichtRPG, you will see an #ifdef MSVC #else #endif that I use to switch between MSVC and DevCPP compiling-- DevCPP ONLY uses int main().
1) use int main()
2) go to project settings and choose GUI instead of Console
If you look at ICE or IrrLichtRPG, you will see an #ifdef MSVC #else #endif that I use to switch between MSVC and DevCPP compiling-- DevCPP ONLY uses int main().
a screen cap is worth 0x100000 DWORDS