void Main not working

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

void Main not working

Post by Robomaniac »

I can't seem to get void main() to work instead of int main(). I want the dos box to dissapear. Whenever i compile with void main(), it says that main must return int. Thanks for any help

~~ The Robomaniac
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

The console does not have to do with void or int main(). It disappears when you use WinMain(), like in the techdemo.
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

I swithched to WinMain, but a console just shows up and then dissapears.

~~The Robomaniac
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Did you do it like in the techdemo? The source can be found in \Examples\techdemo\
Robomaniac
Posts: 602
Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:

Post by Robomaniac »

I copied and pasted the winmain from the tech demo and it shows the console as stated above. the only difference is that i am not using classes, and i'm using OpenGL. I included windows.h also. one more thing, how can you delete text, say for a gui that has a text that says "Loading..." that dissapears when loading is done. Thanks

~~ The Robomanaic
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, it works here. Maybe I should try with DevC++ and OpenGL, maybe there is a problem. BTW: In windows, there is a function for making the console window invisble. Don't know the name, but I think you can find it yourself. :)

Deleting text works with ->remove(), making it invisible works with ->setVisible(false);
[dx/x]=HUNT3R
Posts: 271
Joined: Sat Aug 23, 2003 5:52 pm
Location: Hurricane Central, Florida

Post by [dx/x]=HUNT3R »

You cant have a main funtion that returns nothing (void) it has to return something. But you can get rid of that console easily by making a int WINAPI winMain(......) function and an LRESULT CALLBACK function to handle window messages. If you've never seen this done before check out the tutorials on http://nehe.gamedev.net/ or just search gamedev.net or google for game programming tutorials. Most will be in Visual C++ 6 but thats what you should be using anyway.
Sandy/Moonlight
Posts: 2
Joined: Fri Aug 22, 2003 7:45 am
Location: France

Post by Sandy/Moonlight »

If you use Dev-C++, you only need to add "-mwindow" to your compiler options, or set your project as a Win32 GUI project in the project options (which does the same).
Post Reply