Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » How to link to external libraries
How to link to external libraries [message #11522] Sun, 16 September 2007 13:49 Go to next message
Ishi is currently offline  Ishi
Messages: 5
Registered: July 2007
Location: Middlesbrough, UK
Promising Member
Hi all.

I've got a .lib and .h file that I want to link to in my project - not sure where I'm going wrong though. The files are in C:\lib\TXF.

In Setup->Build Methods, I've added that directory to the INCLUDE and LIB sections. Then in the Package Organizer I've tried adding TXF.lib as a library, and as various other things, (leaving the When bit empty), but when I try and compile, I just get linker errors about the library's functions not being defined.

If anyone can point out what I might be missing or doing wrong, that'd be brilliant. Thanks in advance!
Re: How to link to external libraries [message #11524 is a reply to message #11522] Sun, 16 September 2007 15:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ishi wrote on Sun, 16 September 2007 07:49

Hi all.

I've got a .lib and .h file that I want to link to in my project - not sure where I'm going wrong though. The files are in C:\lib\TXF.

In Setup->Build Methods, I've added that directory to the INCLUDE and LIB sections. Then in the Package Organizer I've tried adding TXF.lib as a library, and as various other things, (leaving the When bit empty), but when I try and compile, I just get linker errors about the library's functions not being defined.

If anyone can point out what I might be missing or doing wrong, that'd be brilliant. Thanks in advance!


Project/Package organizer, click host package, right-click right big pane, choose "New Libraries".

You can look to e.g. Draw or Core package for example how the names of libraries are to be entered.

Mirek
Re: How to link to external libraries [message #11529 is a reply to message #11524] Sun, 16 September 2007 18:07 Go to previous messageGo to next message
Ishi is currently offline  Ishi
Messages: 5
Registered: July 2007
Location: Middlesbrough, UK
Promising Member
Thanks for the reply. Unfortunately I still can't get it to work. I've taken some screenshots so you can see my setup better:

http://i1.tinypic.com/4mudy7n.png
http://i17.tinypic.com/4zksjr8.png

I'm including C:\lib\TXF\TXF.h with a simple #include <TXF.h> which seems to work fine.

I'm trying to use the lib C:\lib\TXF\TXF.lib, and that's the bit that doesn't seem to work for some reason.

My error output is:

Linking...
(option '-O 2' ignored)
File 'libcmt' not found.
File 'oldnames' not found.
File 'libcpmt' not found.
___main: duplicate
-> used:      libmingw32.a:gccmain.o:1
-> discarded: libgcc.a:__main.o:1
2 undefined symbol(s):
TXF::Document::Document(char const*)(referenced from c:\upp\out\engineeditor\mingw.debug_full.gui.main\editor-project.o:1; std::__verify_grou
	ping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&); CEditor::saveProject(bool
	); CEditor::saveProject(bool); ...)
TXF::Document::~Document()(referenced from c:\upp\out\engineeditor\mingw.debug_full.gui.main\editor-project.o:1; std::__verify_grouping(char 
	const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&); CEditor::saveProject(bool); CEditor
	::saveProject(bool); ...)
linking aborted due to fatal errors
collect2: ld returned 1 exit status


Thanks again for any help, much appreciated.
Re: How to link to external libraries [message #11530 is a reply to message #11529] Sun, 16 September 2007 20:45 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Try Setup/Verbose flag, it will show you the actual compiler commandline. If it does not help, post them here.
Re: How to link to external libraries [message #11535 is a reply to message #11530] Sun, 16 September 2007 22:25 Go to previous message
Ishi is currently offline  Ishi
Messages: 5
Registered: July 2007
Location: Middlesbrough, UK
Promising Member
c++ -static -mwindows -o "C:\upp\out\MINGW.Debug_full.Gui\EngineEditor.exe" -ggdb -L"C:\upp\mingw\lib" -L"C:\lib\TXF" -Wl,-O,2 "C:/upp/out/E
ngineEditor/MINGW.Debug_full.Gui.Main\$blitz.o" " C:/upp/out/EngineEditor/MINGW.Debug_full.Gui.Main\EngineEdit or$rc.o " "C:/upp/out/EngineE
ditor/MINGW.Debug_full.Gui.Main\Editor-Project.o" "C:/upp/out/CtrlLib/MINGW.Debug_full.Gui\CtrlLib.o" "C:/upp/out/CtrlLib/MINGW.Debug_ful
l.Gui\$blitz.o" "C:/upp/out/CtrlLib/MINGW.Debug_full.Gui\ChWin32.o" "C:/upp/out/CtrlCore/MINGW.Debug_full.Gui\CtrlCore.o" "C:/upp/out/Ctr
lCore/MINGW.Debug_full.Gui\$blitz.o" "C:/upp/out/RichText/MINGW.Debug_full.Gui\RichImage.o" "C:/upp/out/RichText/MINGW.Debug_full.Gui\$bl
itz.o" "C:/upp/out/Draw/MINGW.Debug_full.Gui\$blitz.o" "C:/upp/out/Core/MINGW.Debug_full.Gui\$blitz.o" "C:/upp/out/Core/MINGW.Debug_full.
Gui\OL_Set.o" "C:/upp/out/plugin/bmp/MINGW.Debug_full.Gui\BmpReg.o" "C:/upp/out/plugin/bmp/MINGW.Debug_full.Gui\$blitz.o" "C:/upp/out/plu
gin/z/MINGW.Debug_full.Gui\adler32.o" "C:/upp/out/plugin/z/MINGW.Debug_full.Gui\compress.o" "C:/upp/out/plugin/z/MINGW.Debug_full.Gui\crc
32.o" "C:/upp/out/plugin/z/MINGW.Debug_full.Gui\deflate.o" "C:/upp/out/plugin/z/MINGW.Debug_full.Gui\gzio.o" "C:/upp/out/plugin/z/MINGW.D
ebug_full.Gui\infblock.o" "C:/upp/out/plugin/z/MINGW.Debug_full.Gui\infcodes.o" "C:/upp/out/plugin/z/MINGW.Debug_full.Gui\inffast.o" "C:/
upp/out/plugin/z/MINGW.Debug_full.Gui\inflate.o" "C:/upp/out/plugin/z/MINGW.Debug_full.Gui\inftrees.o" "C:/upp/out/plugin/z/MINGW.Debug_f
ull.Gui\infutil.o" "C:/upp/out/plugin/z/MINGW.Debug_full.Gui\trees.o" "C:/upp/out/plugin/z/MINGW.Debug_full.Gui\uncompr.o" "C:/upp/out/pl
ugin/z/MINGW.Debug_full.Gui\zutil.o" "C:/upp/out/plugin/png/MINGW.Debug_full.Gui\pngreg.o" "C:/upp/out/plugin/png/MINGW.Debug_full.Gui\pn
glib.o" "C:/upp/out/plugin/png/MINGW.Debug_full.Gui\pngupp.o" -Wl,--start-group -ladvapi32 -lcomdlg32 -lcomctl32 -luser32 -lgdi32 -ladva
pi32 -lshell32 -lwinmm -lole32 -loleaut32 -luuid "C:\lib\TXF\TXF.lib" -Wl,--end-group


There we go. The .lib path and filename are correct. That's as far as my analysis goes, I have no idea what the rest of the options do or if they're relevant or not. Smile
Previous Topic: New mingw version
Next Topic: problem with compilation/linking - Duplicate .cpp file in single package
Goto Forum:
  


Current Time: Mon May 06 06:07:28 CEST 2024

Total time taken to generate the page: 0.02575 seconds