Author Topic: compiling fine on command line, having issues with codeblocks settings  (Read 788 times)

Offline Dracunos

  • Single posting newcomer
  • *
  • Posts: 2

Hello, I'm having a weird issue with the pdcurses library.. My code is good, it works, it compiles, it runs on multiple pcs.. I only use codeblocks on my laptop, and while I can compile just fine through the command line on my laptop, it is giving me undefined references to the pdcurses library I used when I compile via codeblocks.

Basically, I need help making sure codeblocks is doing exactly the same thing that is working perfectly fine in my terminal. The exact working command I run in the command line is:

G:\mingw\bin\mingw32-g++ main.cpp output.cpp entities.cpp input.cpp components.cpp gameInit.cpp startMenu.cpp inputOutput.cpp -lpdcurses -std=c++11

I made sure that the global compiler settings for the selected compiler had base directory set to g:\mingw, and that the toolchain executables were there.. Specifically I have mingw32-g++.exe selected for my c++ compiler. I re-created the whole project after that just in case.

In the project build options I unchecked every box in compiler flags except std=c++11. I added '-lpdcurses' to the 'other compiler options' tab. I made sure every single other tab and sub-tab in that whole menu was empty. I did this for the project root, and for debug, which is my build target.

I made sure every cpp and h file was in my build target files.


To get it to compile via command line, I had to have libstdc++-6.dll (from G:\mingw\bin) in the working directory. It also needed that file in the working directory to run properly. Without that I was getting linker errors, presumably because there's another version of a libstdc++-6.dll in my path somewhere.

In case it was a system path issue, I've temporarily moved the G:\mingw\bin directory to the very front of my path, but no change.


Thank you for your time and assistance.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2492

Offline sodev

  • Regular
  • ***
  • Posts: 325
Re: compiling fine on command line, having issues with codeblocks settings
« Reply #2 on: September 25, 2018, 08:55:23 am »
-lpdcurses has to be a linker option, not a compiler option.

Offline Dracunos

  • Single posting newcomer
  • *
  • Posts: 2
Re: compiling fine on command line, having issues with codeblocks settings
« Reply #3 on: September 26, 2018, 03:25:38 pm »
-lpdcurses has to be a linker option, not a compiler option.


Thank you very much for your help, it works great now.

'I could have sworn I tried that' is the classic newbie excuse I'll use on this one, sorry.

And I'm sorry I didn't notice the rule about posting the build log, I will remember that for future issues.