Author Topic: Compiling a file without a console  (Read 5830 times)

Offline Awar

  • Single posting newcomer
  • *
  • Posts: 3
Compiling a file without a console
« on: December 14, 2010, 06:31:54 pm »
Hello,
I wish to know if there is a way to compile a program [a single program outside of any project] so that a command console doesn't show up. I know it's possible with a project after setting it's type to GUI application, and it does indeed work. But is it possible without joing a file to an existing project? I tried putting -mwindows in linker settings, but it didn't work.

Specification:
I may have not make myself clear. Putting m-windows does work as it is supposed to. After running the *.exe from outside code::blocks the console does not pop up. What I wanted to know is - Is it possible to tell code::blocs not to display the console while running the program from inside it (by pressing F9 or ctrl+F10). Is there a switch somewhere or is it hardcoded?
« Last Edit: December 14, 2010, 07:37:47 pm by Awar »

Offline Greatwolf

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Compiling a file without a console
« Reply #1 on: December 16, 2010, 01:24:05 am »
The console popup will come up if it's run with cb_console_runner.exe. If you have 'Pause when execution ends' checked then that will cause a console popup so it can display execution time.

If you're trying to do this without any projects open(if you just have one source file open by itself) then C::B is just going to run it with cb_console_runner. There doesn't appear to be any way to change that behavior directly. This is not a typical use case in C::B and it sounds like that's what you're looking to do. Why do you want to do this instead of creating a project to go with it?

Offline Awar

  • Single posting newcomer
  • *
  • Posts: 3
Re: Compiling a file without a console
« Reply #2 on: December 16, 2010, 07:44:17 pm »
Thx for your answer. As for why? Just for my own comfort. I find working on single files more to my liking, be it me weirdness or just lack of experience to find the advantages of projects. And while working on graphics the console window is just a pain in the neck serving no purpose whatsoever.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Compiling a file without a console
« Reply #3 on: December 16, 2010, 08:04:44 pm »
Hm, console is great for printf  :)
Especially, when debugging animations...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Greatwolf

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Compiling a file without a console
« Reply #4 on: December 17, 2010, 02:48:32 am »
you'll have a hard time splitting up multiple source files without a project to go with it. Debugging might not even work either.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Compiling a file without a console
« Reply #5 on: December 17, 2010, 06:34:13 am »
you'll have a hard time splitting up multiple source files without a project to go with it. Debugging might not even work either.
Debugging inside C::B does not work without a project.

Offline Awar

  • Single posting newcomer
  • *
  • Posts: 3
Re: Compiling a file without a console
« Reply #6 on: December 17, 2010, 10:23:16 am »
Quote
Hm, console is great for printf.
Console would be great for printing, alas, SDL which I am using redirects the standard in/out stream, and so I can't get anything to show on the console. There probably is a way to connect some stream back to the console, but I don't know one. For now I'm using a string to external file for that purpose. I only started programming about two months ago, and my knowlagde is rather limited, therefore I ask for same leniency of you for "nooby" questions.

Quote
Debugging inside C::B does not work without a project.
All right that is probably a major point. Had I known how to use a debugger that is. Well, time to learn I guess ^^.