# 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.

## 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.

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.

##### 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 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 on other sites
Oh!

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 on other sites
No problems and you too!

1. 1
2. 2
3. 3
4. 4
Rutin
22
5. 5

• 13
• 19
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632933
• Total Posts
3009297
• ### Who's Online (See full list)

There are no registered users currently online

×