project-navigation
Personal tools

Author Topic: Visual Studio 2005 Linking Errors  (Read 15738 times)

Epsilon

  • Guest
Visual Studio 2005 Linking Errors
« 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

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Visual Studio 2005 Linking Errors
« Reply #1 on: April 16, 2007, 06:52:41 am »
cl_event.c seams to be missing, too

Epsilon

  • Guest
Re
« Reply #2 on: April 16, 2007, 09:31:48 am »
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

Alex

  • Guest
Visual Studio 2005 Linking Errors
« Reply #3 on: April 16, 2007, 11:58:54 am »
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.

Epsilon

  • Guest
Visual Studio 2005 Linking Errors
« Reply #4 on: April 16, 2007, 05:06:08 pm »
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

Alex

  • Guest
Visual Studio 2005 Linking Errors
« Reply #5 on: April 17, 2007, 05:43:45 am »
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...

Epsilon

  • Guest
Still not working...
« Reply #6 on: April 18, 2007, 12:29:34 pm »
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...

Alex

  • Guest
Visual Studio 2005 Linking Errors
« Reply #7 on: April 18, 2007, 01:11:04 pm »
In your library path settings, try changing

..\..\src\ports\win32\

to

C:\[direct path here]\src\ports\win32\

Epsilon

  • Guest
Visual Studio 2005 Linking Errors
« Reply #8 on: April 18, 2007, 02:47:01 pm »
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:
...

Alex

  • Guest
Visual Studio 2005 Linking Errors
« Reply #9 on: April 18, 2007, 03:15:12 pm »
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.

Epsilon

  • Guest
Visual Studio 2005 Linking Errors
« Reply #10 on: April 18, 2007, 04:08:08 pm »
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".

Alex

  • Guest
Visual Studio 2005 Linking Errors
« Reply #11 on: April 18, 2007, 05:14:30 pm »
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.

Epsilon

  • Guest
Quick Question
« Reply #12 on: April 18, 2007, 06:24:10 pm »
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.

Alex

  • Guest
Visual Studio 2005 Linking Errors
« Reply #13 on: April 18, 2007, 07:08:54 pm »
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++ ?

Offline Voller

  • Squad Leader
  • ****
  • Posts: 104
    • View Profile
Visual Studio 2005 Linking Errors
« Reply #14 on: April 18, 2007, 08:55:57 pm »
I tried to compile another open source project 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, which comes with MinGW.

Maybe it's a similar problem in your case?