Author Topic: Curses Compiling differently in Code::Blocks than on Command Line  (Read 4963 times)

Offline Atrixium

  • Single posting newcomer
  • *
  • Posts: 3
Curses Compiling differently in Code::Blocks than on Command Line
« on: September 06, 2011, 07:26:43 pm »
Okay, so I have a weird one. This may be a bug, or it might be an RTFM issue, I hope it's not because i've been combing this site and the wiki for even the slightest hint since Friday and I've come up empty.

Here's the situation:

When I compile my simple C++ Roguelike and link with the Curses library using the build and run function in Code::Blocks, I end up with text that's white on black even though I'm expecting colours. Thinking it might be the Code::Blocks console failing to display colour, I tried it in terminal and it is indeed white on black.

When I compile from the terminal (g++ main.cpp -L/usr/lib -lcurses -o test) I get all the colours I'm expecting.

I've checked my settings to make sure that Code::Blocks is pointing the linker to the right library and the compiler doesn't have any flags set. I tried removing and reinstalling Code::Blocks (I'm running 10.05 Debian Binary Release) and it had no effect.

I am now thoroughly stumped, is there anyway to see what command line options Code::Blocks is passing to g++?

Any help would be greatly appreciated!

zabzonk

  • Guest
Re: Curses Compiling differently in Code::Blocks than on Command Line
« Reply #1 on: September 06, 2011, 08:42:36 pm »
Make CB produce a log for every compilation:

Settings | Compiler & Debugger.. | Build Options

And then make sure that the "Save build log to HTML" and "Always output full command line" options are checked. This will write  a build log, with compiler options,  into your project directory for every compilation, so you can see exactly what has happened.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Curses Compiling differently in Code::Blocks than on Command Line
« Reply #2 on: September 06, 2011, 09:04:52 pm »
Much more usable:
change "Settings -> Compiler and debugger... -> Global compiler settings -> [your compiler] -> Other settings (rightmost tab) -> Compiler logging:" to "Full commandline".
This will not be saved, but is instantly visible in "Build log".

zabzonk

  • Guest
Re: Curses Compiling differently in Code::Blocks than on Command Line
« Reply #3 on: September 06, 2011, 09:37:22 pm »
@Jens Is there some reason why one or the other of these is not switched on by default?

Offline Atrixium

  • Single posting newcomer
  • *
  • Posts: 3
Re: Curses Compiling differently in Code::Blocks than on Command Line
« Reply #4 on: September 07, 2011, 08:04:23 am »
Thanks for the replies, I was able to solve it after turning on logging.

I compiled and linked with the commands it was using and slowly removed options until the issue disappeared, it turned out to be a bad include that was including a different header file than the one I was expecting, modifying my search directories for the compiler fixed it!

@Neil I was unable to find the option you directed me to but stumbled upon the "Other Settings" section that jens mentioned myself while trying to find it. Even looking now I can't seem to find the Build Options section, maybe it was removed in 10.05?

Thanks again for the help, Code::Blocks rocks!  :D

zabzonk

  • Guest
Re: Curses Compiling differently in Code::Blocks than on Command Line
« Reply #5 on: September 07, 2011, 10:02:40 am »
> I was unable to find the option you directed me to but stumbled upon the "Other Settings" section that jens mentioned myself while trying to find it. Even looking now I can't seem to find the Build Options section, maybe it was removed in 10.05?

More likely it was added after 10.05 - I use a recent nightly.


Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Curses Compiling differently in Code::Blocks than on Command Line
« Reply #6 on: September 07, 2011, 10:11:46 am »
In 10.05 it's in "Settings -> Compiler and debugger... -> Global compiler settings -> [your compiler] -> Other settings (rightmost tab)".
Check "Save build log to HTML..." and the checkbox below.