Author Topic: Preventing Code::Blocks Build log dialog box from appearing when building a .cbp  (Read 11551 times)

Offline nhiorns

  • Single posting newcomer
  • *
  • Posts: 4
I am using the command line to rebuild a codeblocks project with the following command:

codeblocks --rebuild ProjectName.cbp > build.txt

This rebuilds the project and prints the build log to the build.txt file.

The build log is however also displayed in a pop up dialog box which I do not want. Is there any way of getting the project to build without this dialog box appearing? The code::blocks documentation states that using '> <filename>' redirects output to the file specified, which it does, but it does not prevent the dialog box from opening.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
...if you run Code::Blocks with the /? option, you'll see all available command line switches.

These are:

Usage: codeblocks.exe [/h] [/?] [--safe-mode] [/na] [/nd] [/ns] [--multiple-instance] [/d] [/nc] [/v] [--prefix <str>] [/p <str>] [--no-log] [--log-to-file] [--debug-log-to-file] [--profile <str>] [--rebuild] [--build] [--clean] [--target <str>] [--no-batch-window-close] [--batch-build-notify] [--script <str>] [--file <str>] [filename(s)...]
  /h, --help                     show this help message
  /?, --?                        show this help message (alias for help)
  --safe-mode                    load in safe mode (all plugins will be disabled)
  /na, --no-check-associations   don't perform any association checks
  /nd, --no-dde                  don't start a DDE server
  /ns, --no-splash-screen        don't display a splash screen while loading
  --multiple-instance            allow running multiple instances
  /d, --debug-log                display application's debug log
  /nc, --no-crash-handler        don't use the crash handler (useful for debugging C::B)
  /v, --verbose                  show more debugging messages
  --prefix=<str>                 the shared data dir prefix
  /p, --personality=<str>        the personality to use: "ask" or <personality-name>
  --no-log                       turn off the application log
  --log-to-file                  redirect application log to a file
  --debug-log-to-file            redirect application debug log to a file
  --profile=<str>                synonym to personality
  --rebuild                      clean and then build the project/workspace
  --build                        just build the project/workspace
  --clean                        clean the project/workspace
  --target=<str>                 the target for the batch build
  --no-batch-window-close        do not auto-close log window when batch build is done
  --batch-build-notify           show message when batch build is done
  --script=<str>                 execute script file
  --file=<str>                   open file and optionally jump to specific line (file[:line])


...in particular:
--batch-build-notify           show message when batch build is done
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline nhiorns

  • Single posting newcomer
  • *
  • Posts: 4
Thanks for the reply.

I knew that switch already and in fact that one causes another dialog box to pop up notifying me that the build is complete. This is on top of the build log box which appears when I run the script, so this is further from my goal I'm afraid.

I am running codeblocks on a linux system, and so when the codeblocks dialog box appears, I have to then click to activate it and it then starts printing the build log to screen. This is not very command-line-esque, I would like to be able to execute the command which will build the project with no further interaction on my part. I don't mind if the build log is printed to the terminal (which it is) or even to a file, but I do not want an extra box popping up containing the same info.

I have tried the:
--log-to-file
--no-log
switches, which do not solve my problem either!

Noel
« Last Edit: October 02, 2013, 11:21:39 am by nhiorns »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
I suggest trying the option
Code
--profile="batch"
because you need to rule out the idea that you set a option in CB that does this.
Creating a new profile just for batch builds that is created with the CB default setting might help you get ride of this issue.

You might also try before or after that.
Unchecking the items under the "view" menu.

Edited: The quotes around profile option.


Tim S.
« Last Edit: October 01, 2013, 03:46:27 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
...I was about to say the same: Try with a clean config for batch builds. Because for me it works just fine here, however, I've done some modification to the batch build system. I would need to check against trunk and/or simply a nightly.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline nhiorns

  • Single posting newcomer
  • *
  • Posts: 4
Having made no changes to the batch build settings, on running the command with

Code
--profile="batch"

included, it first displays a window prompting me to select the compiler I want to use and then any subsequent times running the command it executes as previously described with the build log window appearing.

I am going to investigate the batch build settings to see if there is anything I can modify in that respect. All I am aiming for is a completely GUI free way of building my codeblocks project from the command line.

Thanks

Noel

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Found the GUI location to do setting for this type of thing.

 "Settings" -> "Compiler" [Batch Builds]

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline nhiorns

  • Single posting newcomer
  • *
  • Posts: 4
That is what I meant by:

Quote
I am going to investigate the batch build settings

I had found that particular settings page, it doesn't seem to offer anything more than what you can already do with a command line command though.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
That is what I meant by:

Quote
I am going to investigate the batch build settings

I had found that particular settings page, it doesn't seem to offer anything more than what you can already do with a command line command though.

I strongly suggest removing the options that you do NOT want!

What if the GUI options override the command line options?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Bafino

  • Guest
Has this issue been solved? I am trying to run codeblock —rebuild in Jenkins, but it open the GUI and hangs. Is there a way to disable that GUI to pop up so the command could run in automation that doesn’t have active or interactive windows?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
nope, sadly the state of this is the same...
But you can run codeblocks on a headless server with using an virtual x server:
Code
export DISPLAY=:1
Xvfb :1 -screen 0 1024x768x16 &
codeblocks --target=All --no-splash-screen --build myproject
As long as no message box with an error pops up you should be fine :)

i use this in my own automated build scrip:
https://github.com/bluehazzard/codeblocks_build_utilities/blob/master/build_all