User forums > Help
Linking Problem now...
russose:
Hallo,
First Thanks for this very good program. I discovered it a few weeks ago and I am very happy with it.
But I have some problems...
1) I am working on a workspace with 30 projects (imporrted from VC6 projects). One of this project is the main executable and the other projects are internal libraries. Everythink is compiling fine but during linking, if I specify the libraries to use in the 'build option' of the main project, Code::Blocks doesn't manage to link (lot of unresolved external function blbla). But if I specify these libraries in 'setting->compiler->linker', it works fine... each time I will update code::block, I will have to do it :=( ??
2) I am using python.lib and I had problems to link it. With the RC2, it was not working... I had thousands of 'undefined reference to blabla' but not in red... I only managed to make it link if I ONLY specified "python23" in 'setting->compiler->linker' and specified the right directory in 'setting->compiler->directory->linker'... it was the only way to make it link (I tried almost everythink else possible :=) )
3) But when my application was running, I wanted to use the debugger but it was not working with breakpoints . So I downloaded gdb 6.3 and a the last version CodeBlocksSVN20051224.7z. The good surprise is that the debugger is working very good!! But now, if I build my application again, I have no way to link python :=( "python23" is not found... I have to pick it from the codeblock explorer but then, I have these 100000 unresolved imp_blabla.
Has someone an idea about what I am doing wrong? Is there a way to easily link my library specifying locally in the project option everything (to share it also).
Thanks for your help,
Salvatore
thomas:
1) This is most likely because you were using #pragma lib or whatever it is called.
It is not your fault, blame Microsoft. People who use MS products often have that kind of problem because they do things which they have learned as "correct and normal" when in fact it is not correct and normal at all, but MS teaches you so.
If you need to link to a library, you certainly have to tell the linker to do that (usually via the commandline, but MS also has this pragma stuff).
You will not have to do it again every time you update Code::Blocks, as this gets saved with your project (you will have to do it if you re-import, though).
2) You should use .a libraries instead of .lib (use the tool reimp which comes with MinGW to convert the lib if you don't have a .a library). The correct way to add libraries is by either providing the name (without prefix or extension), so the IDE will complete the filename, or (not recommended) by providing a full path/filename. Alternatively, you can add -lyourLibraryName to the command line options, but again this is not recommended (it is complicated and not necessary, the IDE can do the dirty work for you).
3) Yes, the debugger has lately been greatly improved, you should always use a recent build for debugging.
Please note that RC2 and the build from HEAD use different methods to store the configuration. So you will have to set up the system lib directories again when migrating to HEAD (this may be why the lib is not found).
EDIT:
1) and 2) Of course you can just use the MSVC toolkit with Code::Blocks, too. In that case, the #pragma works again.
russose:
Hallo Thomas,
Thanks for your quick (!) answer.
1) The project are not using pragma (because it should compile on every platform... mac, linux, windows. So the problem should not be here.
Do I really understood good: information stored in "setting->compiler" are saved with the projects? I didn't experience that. When I opened my project on an other computer, I had to write all information again... but maybe I made something wrong??
2) I will try again what you advise... I will only write the nane of libraries in "build opetion-> linker" and give the directoriy separatly in "directory->linker"...
3) ah ok, I will built everything again...
Thanks again for your help and I hope I will make it work.
Salvatore
russose:
After some checks, it seems that the problem was caused by differencies between the list of linked library in "build option->linker" and "setting->compiler->linker"
If there are differencies, then I receive strange ling error, "unresolved external function..." but everything works fine if the list of library is the same... strange behaviour.
I also noticed that a problem could come from "space in directory name" such "Programm Files" (we have to write "Program~1".
Now everything is working really good!! Thanks for this amazing programm!
Salvatore
thomas:
--- Quote from: russose on December 27, 2005, 02:55:59 pm ---Do I really understood good: information stored in "setting->compiler" are saved with the projects?
--- End quote ---
No, the compiler settings are stored in the config (registry for RC2, XML file for HEAD). The build options which you can access by right-clicking the project are stored in the project file. This is the correct place to put the link libraries, too, since they depend on the project, and do not apply to every program which you possibly write.
Navigation
[0] Message Index
[#] Next page
Go to full version