Using libraries with Code::Blocks

A helpful post for someone having trouble using libraries with codeblocks:…-odeblocks/

By the way, I don’t know if it has been mentioned before somewhere on the forum but
this site for C++ programming is incredible.


this is great, the site has a lot of good info.


thanks for posting this - it was rather helpful in getting my first windows code:blocks probject to work.

i’m hoping that somebody could lend their expertise with dynamic libraries. i’m trying to create a project with mysql connector ( for windows. it ships with both static and dynamic libs, but i haven’t had much luck with either.

the project compiles fine when i include the header files, but as soon as i use any of the library’s functions, i get ‘undefined reference’ errors.

the lib is included in the linked libraries section and the header files in the search directories. i even tried including both libmysql.dll and mysqlcppconn.dll in the bin folder. i think that i’ve covered all of my bases, but is there anything else that i could be missing? does anything need to be included in the other linker options?

thanks++ for any advice,


hi @mantissa … long post … same problems :wink:

i’m having similar problems trying to compile FFMPEG under Windows 7 …
i’ve tried same strategies … with no luck …

  • include .h’s
  • add compiler path with h’s path
  • add “.lib” to project tree
  • add “.lib” on linker settings …

any idea of what might be missing or wrong ?
i’m not used to OF under windows anymore and i feel totally lost …

Hi @eloi, I don’t know about ffmpeg, but I successfully added PCL to a CB project. Details are in the readme of, but in brief,

  • Project -> Add files to add source
  • In Project -> Build options -> Search directories, select the project name on the top left, and add header paths
  • In Linker settings, add Link libraries (like -lxxx)
  • In other linker options, add -Lpath\to\lib
  • In Pre/post build steps, append dll copy commands (or manually copy them)

Great ! Thanks @micuat !! Following your instructions from scratch … make my day !!

Seems like i was trying to link against the 64 bits libs … When redoing it all i choosee the 32 bit and it worked !!
Thanks a lot !!