Jump to content
  • Advertisement
Sign in to follow this  

OpenGL OpenGL - Console application when compiled with MingW

This topic is 2848 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

Hello everyone!

How are you? I'm great. I recently defended my Bachelor of IT-Engineering
to a pretty nice grade. Now it's time to get back to business.

Therefore, I'm again putting some time into my projects at home. :)

Anyway, i just stripped my code off my codeblocks project, which once was a MVC++
project. It's just the source files now. - And then MingW.

I made a batch file to copy all my dependencies (Freeglut, soil, glee) into the mingw path, and another batch file to compile and link everything.
I don't even use makefiles, I like it to be very basic now.

The only issue i have is the fact that my "project" is now no longer a console applocation. -And i really want to output relevant information to the console at run-time.

So how can i compile an OpenGL application that doesn't just have a window to render to, but also a console window that i can cout << to, next to it.

Right now, i link just about every file with:

g++ -Wall -pedantic -O2 -c -o obj/voxel_block.o src/bl/voxel_block.cpp -w -D FREEGLUT_STATIC -I"%mingdir%/include" -I"src" -I"src/include"
(Yes, i know i should scrape unnecessary stuff off of the lines, and i will)

And i compile my binary with:

g++ -Wall -pedantic -O2 -o bin/cubes.exe (all .o files here) -w -L"%mingdir%\lib" -lfreeglut_static -lglu32 -lopengl32 -lwinmm -lgdi32 -lstdc++ -Wl,--subsystem,windows

Any input is very welcome, and if you mods think this question belongs elsewhere, please move it.

Thanks in advance! :D

Share this post

Link to post
Share on other sites
I just start with the normal int main(args) for my OpenGL project to get a console.

Edit: Meaning, AFAIK mingw does console with that unless you suppress it.

Edit2: Which you are doing: -Wl,--subsystem,windows

Share this post

Link to post
Share on other sites
Yeah i thought that too, i just thought maybe i was suppressing it somehow through the way i compile and link. - I got:

int main(int argc, char **argv)
, which i think should be sufficient. Note i haven't changed any of my code since i built it through codeblocks. I searched the codeblocks project file, but cannot seem to find anything on console windows... :/

EDIT: Whoa...!

Share this post

Link to post
Share on other sites

Removed the -Wl -bit!
Thanks for the help, man! It's nice to have so quick people around on GD.

Have a happy newyear CRYP7IK, right!

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!