User forums > Using Code::Blocks

Undefined reference (SOLVED)

(1/4) > >>

jury:
I have created Code::Blocks project from cmake (with -G "CodeBlocks - Unix Makefiles")
It compiles, but when linking I get undefined reference. Where do I add libraries for this project?
When searching for help I found this:
https://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_My_build_fails_with_multiple_undefined_reference_errors.3F
saying "Most of the time it is because the required library is not linked with your project. Go to Project->Build options...->Linker settings (tab) and add the required library or libraries"
But I do not have any Linker settings tab there. All I have is "Pre/post build steps", "Custom variables" and "Make"commands. I think I have went through all the possible menu entries, but I can not find any project linker settings.
What am I missing?

(yes, I have seen the same title topic from yesterday, but the advice there is exactly the same as in the link above: go to project -> build options and then linker settings tab)

Code::Blocks 20.3, PCLinuxOS
This project compiles and builds fine in command line.

stahta01:
You are using an CB custom makefile project because of your selection of "CodeBlocks - Unix Makefiles"; therefore you need to edit the makefile to change the build settings used by the makefile!

Tim S.

BlueHazzard:
If you create a project from cmake, then this project is a so called "makefile project". With this type of project the codeblocks build process is circumvented and the cmake build process is used. For this all Settings in the Build options are ignored, because the cmake file is the build reference. If you have to add a library or source file ecc, or anything related to the build process, you have to modify your (c)make file

So you probably have to add some library to your cmake file

[edit:] stahta01 was faster....

jury:
Got it.
Thank you.

(its strange then, that it builds fine when run from command line and fails through code::blocks, must dig in more)

stahta01:

--- Quote from: jury on May 08, 2021, 06:25:02 am ---Got it.
Thank you.

(its strange then, that it builds fine when run from command line and fails through code::blocks, must dig in more)

--- End quote ---

Post the external command line that works.
And, post the build log from CB that fails.

Tim S.

Navigation

[0] Message Index

[#] Next page

Go to full version