Linker problem

CodeLite installation/troubleshooting forum
mrsauce
CodeLite Curious
Posts: 5
Joined: Thu Feb 12, 2015 11:29 am
Genuine User: Yes
IDE Question: c++
Contact:

Linker problem

Post by mrsauce »

Hi,
I have this issue.
I maked a Dynamic Library with the template in the "New project.....ecc"
I saw that the wizard template produced "include" and "src" empty.
This is not the problem because i add the .h and .cpp with the functions of my librar.
I compile my library without problems and i have the output file of my library provadll.dll and provadll.cpp.o
I set my project to use this library but when i start the BUILD i receive this error:

C:\Windows\system32\cmd.exe /C "C:/MinGW/bin/mingw32-make.exe -j4 SHELL=cmd.exe -e -f Makefile"
"----------Building project:[ Prova - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'D:/Download Internet/Progetti_CodeLite/Fabio/Prova'
C:/MinGW/bin/g++.exe -o ./Debug/Prova @"Prova.txt" -Lc:/libreria -lprovadll
c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -lprovadll
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/Prova] Error 1
mingw32-make.exe: *** [All] Error 2
Prova.mk:78: recipe for target 'Debug/Prova' failed
mingw32-make.exe[1]: Leaving directory 'D:/Download Internet/Progetti_CodeLite/Fabio/Prova'
Makefile:4: recipe for target 'All' failed
1 errors, 0 warnings

I set the linker path in "Project-Setting" like this:
"Library Path": c:\libreria (where there is my library)
"Libraries": provadll.cpp.o
but the error persist.

I'm missing something?
Probably i'm wrong something but i don't understand where.

thank's in advanced for eventually reply

Fabio
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Linker problem

Post by eranif »

"Libraries": provadll.cpp.o
You should not attempt to link to object files directly, but rather to libraries and DLLs

The "Library Path" should point to the location where your DLL exists
The "Libraries" should contains list of **libraries**, in your case: Just this: "provadll" (notice that I did not add the .dll suffix as the linker will add it automatically)

Eran
Make sure you have read the HOW TO POST thread
mrsauce
CodeLite Curious
Posts: 5
Joined: Thu Feb 12, 2015 11:29 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: Linker problem

Post by mrsauce »

Hi Eran,
ok now it works properly.
Why if i create a newproject-dynamic library i see the structure with "src" and "include" but are empty and there isn't
a simple .h and .cpp with a basically example of library?
this is only a curiosity.

best regards
Fabio
Post Reply