News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Preventing Code::Blocks Build log dialog box from appearing when building a .cbp

Started by nhiorns, September 30, 2013, 11:43:33 AM

Previous topic - Next topic

nhiorns

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.

MortenMacFly

...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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

nhiorns

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

stahta01

I suggest trying the option
--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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

MortenMacFly

...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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

nhiorns

Having made no changes to the batch build settings, on running the command with

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

stahta01

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

nhiorns

That is what I meant by:

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

stahta01

Quote from: nhiorns on October 03, 2013, 09:19:10 AM
That is what I meant by:

QuoteI 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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Bafino

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?

BlueHazzard

nope, sadly the state of this is the same...
But you can run codeblocks on a headless server with using an virtual x server:

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