UFO:Alien Invasion
Development => Coding => Topic started by: Epsilon on April 15, 2007, 05:45:52 pm
-
Hi
I'm trying to compile the code (trunk revision) in Visual Studio 2005 (full version) but I'm running into linker errors (on the debug alpha and release-SDLT configuration solutions):
cl_campaign.obj : error LNK2001: unresolved external symbol _CL_EventAddMail_f
cl_main.obj : error LNK2019: unresolved external symbol _CL_ParseEventMails referenced in function _CL_ParseScriptFirst
cl_save.obj : error LNK2019: unresolved external symbol _uncompress referenced in function _SAV_GameLoad
cl_save.obj : error LNK2019: unresolved external symbol _compress referenced in function _SAV_GameSave
sys_win.obj : error LNK2019: unresolved external symbol _IsDebuggerPresent referenced in function _Sys_Error
unzip.obj : error LNK2019: unresolved external symbol _crc32 referenced in function _unzReadCurrentFile
unzip.obj : error LNK2019: unresolved external symbol _inflate referenced in function _unzReadCurrentFile
unzip.obj : error LNK2019: unresolved external symbol _inflateEnd referenced in function _unzCloseCurrentFile
unzip.obj : error LNK2019: unresolved external symbol _inflateInit2_ referenced in function _unzOpenCurrentFile3
Can anybody help? I can't seem to get the zlib library to work.
Thanks
-
cl_event.c seams to be missing, too
-
Thanks,
I've added the missing file to the project, but the other linker errors persist:
cl_save.obj : error LNK2019: unresolved external symbol _uncompress referenced in function _SAV_GameLoad
cl_save.obj : error LNK2019: unresolved external symbol _compress referenced in function _SAV_GameSave
sys_win.obj : error LNK2019: unresolved external symbol _IsDebuggerPresent referenced in function _Sys_Error
unzip.obj : error LNK2019: unresolved external symbol _crc32 referenced in function _unzReadCurrentFile
unzip.obj : error LNK2019: unresolved external symbol _inflate referenced in function _unzReadCurrentFile
unzip.obj : error LNK2019: unresolved external symbol _inflateEnd referenced in function _unzCloseCurrentFile
unzip.obj : error LNK2019: unresolved external symbol _inflateInit2_ referenced in function _unzOpenCurrentFile3
-
Unresolved external symbol means the linker can't find the function it needs, which should be in the zlib lib file.
Double check your project settings to make sure the .lib for zlib is included in your link library options.
Also check the zlib folders to see if a .lib file has been created - if not you will have to compile zlib first, otherwise find a precompiled binary of zlib.
Hope that helps.
-
Hi
zlib1.lib is already included as a resouce file in the project itself; and the file the project is using is in the SVN under
trunk\ports\win32\
This is the set of input libraries that is set in the Configuration Properties
(I've added the last line in ..\..\src\ports\win32\zlib1.lib):
kernel32.lib
user32.lib
winmm.lib
wsock32.lib
advapi32.lib
..\..\src\ports\win32\zlib1.lib
but it still gives the same linker errors. Any other ideas?
Thanks
-
You should try removing the ..\..\src\ports\win32\ part of the configuration, just have plain old zlib1.lib in the library includes.
Also make sure that you add the absolute path to zlib into the additional library directories.
So additional library directories should include c:\<path>\src\ports\win32\
And then add zlib1.lib to your dependancies.
That _should_ work...
-
Hi,
I tried the steps you suggested but it's still complaining...
If I switch on verbose mode I see that the library is actually being
searched:
...
Searching ..\..\src\ports\win32\vorbisfile.lib:
Searching ..\..\src\ports\win32\zlib1.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\lib\LIBCMTD.lib:
Found _memchr
Referenced in ogg.lib(framing.obj)
...
I've been playing around with the project switches but I haven't had any luck...
-
In your library path settings, try changing
..\..\src\ports\win32\
to
C:\[direct path here]\src\ports\win32\
-
Tried that, still the same error, with the log pretty much the same:
...
Searching C:\Documents and Settings\xxxx\My Documents\95_AlienInvasion\ufoai\trunk\src\ports\win32\zlib1.lib:
...
Tried copying the lib file into the root directory too and changing the dependancies:
...
Searching C:\zlib1.lib:
...
-
Hm its a tricky problem then, without actually being able to sit at your computer I can't really say any more...
Do a cleanup and build again? (You've probably tried this 100 times)
what is interesting is that on google I find 0 references to zlib1.lib, but hundreds with zlib.lib
i'll have to get on my computer and see if I can recreate the problem.
-
I think zlib1.lib is the same as zlib.lib. From the USAGE.txt file (in the archive from http://www.zlib.net/zlib123.zip):
Installing ZLIB1.DLL
====================
Copy ZLIB1.DLL to the SYSTEM or the SYSTEM32 directory.
Using ZLIB1.DLL with Microsoft Visual C++
=========================================
1. Install the supplied header files "zlib.h" and "zconf.h"
into a directory found in the INCLUDE path list.
2. Install the supplied library files "zdll.exp" and "zdll.lib"
into a directory found in the LIB path list.
3. Add "zdll.exp" or "zdll.lib" to your project.
Notes:
- Usually, you don't need both the .exp file and the .lib file.
- If you wish, you may rename "zdll.exp" to "zlib1.exp", and/or
rename "zdll.lib" to "zlib1.lib".
-
Ok, so if you're sure that the library is correctly linked, the only other thing I can think of is the compiler can't locate the header file... or one of the source files is missing...
Sorry I can't help you - I just can't think what it is...
One final little thing you might try is change the order in which zlib1.lib appears in the list... try moving it to the last place, the first place in the list etc.
-
Hi
Thanks for trying. Just a quick question: are you (or anyone) able to compile and run the code (trunk revision) in VS 2005 (any version)?
Thanks again.
-
No - I'm using .Net 2003 I thought they were both similar...
Have you tried anything other compiler/ide's like code::blocks or devc++ ?
-
I tried to compile another open source project (http://www.marsnomercy.org) with VC++ at some point and had to realise that open source projects sometimes use non-standard notation which VC++ cannot understand, but which is widely accepted among open source compilers.
In oder to compile the sources I downloaded CodeBlocks (http://www.codeblocks.org/), which comes with MinGW.
Maybe it's a similar problem in your case?
-
I have VS 2003 installed - I can give it a try. However, I can't seem to find the appropriate .sln files?
If I can't get this to work, I'll download CodeBlocks or devc++ like you suggest.
Thanks
-
it would be cool if you could fix the linking - compilation is working for all projects - but the linking is not - maybe you can try to other zlib.lib's? or compile one yourself? i have have that much a clue of vc - so i won't be a big help here.
-
Hi All,
After looking at the zlib example projects, I was able to get the project to compile and link. I had to add
ZLIB_WINAPI
to the preprocessor definitions, and remove
Z_PREFIX
.
I also had to add
..\..\src\ports\win32\zlib1.lib
to the dependancies list.
There was one other linker problem:
IsDebuggerPresent()
in sys_win.c. I commented this out for now - can anyone comment on this call?
There are runtime errors, but at least I can get it to compile and link.
-
Nice work dude, glad you got it to work...
Not sure about the other linker problem.