User forums > Using Code::Blocks
Building an application which uses dll's
OldSeaWolf:
Dear members of the forum.
I have met a problem while I decided create a program that uses dynamically linked libraries.
I had created and compiled two test projects of my dlls without any problems and errors. In the process of compilation and linking 3 files were created for each project in the directory bin\debug:
<name>.dll, lib<name>.dll.a, lib<name>.dll.def .
Then I have created a project with a program that must use these dlls (future exe-module), copied lib<name>.dll.a file to the project directory and pointed it in the linker options of the project. I have added these files to the project tree as well. However after I started building (Ctrl-F9), some strange errors of the linker appeared.
Here is a quote:
mingw32-g++.exe: obj\Debug\libinout.dll.o: No such file or directory
mingw32-g++.exe: obj\Debug\libarithm.dll.o: No such file or directory
When I delete these files from the project tree leaving them in linker options another error springs out:
ld.exe: cannot find -larithm.dll
Please explain me what causes these mistakes and what I'm doing wrong. I tried to find this information in the users manual, however I didn't find any (perhaps I was not careful enough in my search). Could you give me a step by step instruction of creating such a project? I have made such projects based on the same source text in Visual Studio and dev-cpp (which contains an older version of MinGW) successfully, but I can't resolve the same problem in this IDE. Could you help me?
stahta01:
Turn on Full Compiler Logging and post the re-build log info.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
Might read and see if this answers your questions
http://wiki.codeblocks.org/index.php?title=Linking_the_plugin_to_a_Nightly_Build#Step_Four_-_Link_Everything_Together
Tim S.
OldSeaWolf:
Tim, here is the full log after Ctrl-F11. If it is necessary, I can send you all the project, it is a simple console application.
-------------- Clean: Debug in main ---------------
Cleaned "main - Debug"
-------------- Build: Debug in main ---------------
mingw32-g++.exe -Wall -fexceptions -g -c "C:\samp\gcd_lcm(2)\dynamic_link (CodeBlocks)\main\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe -o bin\Debug\main.exe obj\Debug\libinout.dll.o obj\Debug\main.o obj\Debug\libarithm.dll.o -larithm.dll -linout.dll
mingw32-g++.exe: obj\Debug\libinout.dll.o: No such file or directory
mingw32-g++.exe: obj\Debug\libarithm.dll.o: No such file or directory
Process terminated with status 1 (0 minutes, 3 seconds)
0 errors, 0 warnings
stahta01:
Something is not right; but, I am not sure what is the cause.
What did you type into the Linker Library search path?
What did you type into the extra/other linker options?
What is the files in the project?
--- Quote ---I have added these files to the project tree as well.
--- End quote ---
Try removing the DLLs from project tree.
Tim S.
OldSeaWolf:
I didn't point any paths to the IDE. I have copied the dll<...>.dll.a files to the main directory of the project (where I put all my sources). And I included these *.a files into the project.
First I added them to the project file-tree, then I pointed them in the linker options:
Project -> Build Options -> Linker Settings -> Link Libraries (Add Button).
Files in the project
Sources:
main.cpp
Headers:
arithm.h
inout.h
Others
libarithm.dll.a
libinout.dll.a
Navigation
[0] Message Index
[#] Next page
Go to full version