User forums > Using Code::Blocks
Help me with the linking of external library
Justin:
I have download some external libraries with extended name .a/.lib, I want to link those libraries to my own project. I have configured the linker and seach path. But there are always problems. I cannot see the API lists of those libraries, and I cannot call the functions enveloped in those libraries.
My OS is Vista, and I am using the lastest version of CB.
What's wrong? Help!
Ceniza:
Enable full compiler logging and copy&paste the problem here.
From Morten's signature: Logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
Justin:
-------------- Build: Debug in testC ---------------
mingw32-g++.exe -Llib -o bin\Debug\testC.exe obj\Debug\main.o lib\libcluto.a
obj\Debug\main.o: In function `main':
D:/CppProjects/testC/main.c:73: undefined reference to `_CLUTO_VP_ClusterRB
'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
Justin:
the document of those libraries said the libraries were compiled with gcc, so did I use the wrong compiler, that is to say not mingw32-g++.exe, but mingw32-gcc.exe?
Jenna:
--- Quote from: Justin on December 05, 2008, 09:57:57 am ---the document of those libraries said the libraries were compiled with gcc, so did I use the wrong compiler, that is to say not mingw32-g++.exe, but mingw32-gcc.exe?
--- End quote ---
I don't think so.
gcc is either the gnu-compiler-collection or the c-compiler included in gcc, in both cases it should not be causing your problem.
But if the lib really was compiled with mingw32-gcc it's a c-library and you have to declare the functions inside the header as extern "c" to make them usable with c++.
google for extern "c", to see how you can do this.
Navigation
[0] Message Index
[#] Next page
Go to full version