User forums > Help
Linking multiple chain-dependent static libs
Digited:
declspec - for dynamic libs, not static. Static lib is just a container of objs, not a compiled and linked executable binary, as exe or dll. There's no difference in how many static libs you have in addition to .exe or .dll - the same linking of objs is made at the end, it's just a method of splitting up the code for faster compilation, when code is oftenly modified.
Now I changed nothing, and linker doesn't find one of the existing libs. I've done with mingw, for sure. Maybe later, with 4.x.x
Topic can be closed.
thomas:
I don't think you'll have more luck with a different compiler, but feel free to try. It may be that you accidentially fix what's wrong in your project if you switch to a different compiler.
Without knowing any details, it is impossible to tell of course, but at least two things that could be wrong come to my mind: 1. having built GLEW wrong (missing the required define, or omitting it in your project), and 2. having circular dependencies in your s1, s2, s3.
You are right that declspec is not needed for static libraries.
Digited:
I've forgot to write about solution...
After I've tried ms compiler, it showed a strange error in one of my static libs - with HWND in header. I tried different tricks, finally removed HWND by void*, all worked fine.
Of cource after that I tried to compile solution with mingw, but it failed with more strange errors in code that was compiling without errors before - for that I'm sure, becouse I changed nothing there since successful compiling. That was enough, so I moved to ms compiler on windows absolutely. In other words, if there was a hidden reason for all link errors, I just didn't find it.
Thanks for trying to help, stahta01, Thomas.
(p.s. now we're experimenting with D 1.00, dmd compiler - the language looks absolutely fantastic, it must have a dark side... Or must not?..)
Digited:
Linkers hate me. Prove:
D project, DigitalMars D compiler & linker, compiling static lib project:
-------------- Build: Release_Win32 in mylib ---------------
dmd.exe -release -O -inline -release -O -inline -I..\..\ -I..\..\ -Ibin -IC:\dm\src\phobos -IC:\dmd\src\phobos -c file1.d -of.\bin\obj\file1.obj
dmd.exe -release -O -inline -release -O -inline -I..\..\ -I..\..\ -Ibin -IC:\dm\src\phobos -IC:\dmd\src\phobos -c file2.d -of.\bin\obj\file2.obj
lib.exe .\bin\mylib.lib .\bin\obj\file1.obj .\bin\obj\file2.obj
Digital Mars Librarian Version 8.02n
Copyright (C) Digital Mars 2000-2007 All Rights Reserved
http://www.digitalmars.com/ctg/lib.html
Error: .\bin\mylib.lib : No such file or directory
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings
Does anyone have an idea what's wrong? mylib.lib was not linked in .\bin dir...
Digited:
Fixed: in spite of lib-linker command line description in its docs
"switches...
Zero or more of the following. If none of -c, -d or -x is specified, the default action is to add the objfiles to the library."
the D lib-linker (lib.exe) MUST get -c in command line to link a static lib.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version