Migration to VS2005

G

Guest

I have a command line project that I am migrating from VS2003 to VS2005.
There is a combination of C, C++ and C#. When I build the project, I have
this in my call to cl.exe in my batch file:

/link /nodefaultlib:libc /nodefaultlib:libcmt /nodefaultlib:libcd

My compile gets three unresolved externals:

Searching C:\Program Files\Microsoft Visual Studio 8\VC\LIB\kernel32.lib:
Searching c:\mbs7\sys\lib\expbin\minofuncs.lib:
Searching c:\mbs7\sys\lib\bin\mbs4.lib:
Searching c:\mbs7\sys\lib\bin\WBTRV32.LIB:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\LIB\uuid.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\LIB\OLDNAMES.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\LIB\MSVCRT.lib:
Searching C:\Program Files\Microsoft Visual Studio 8\VC\LIB\MSVCMRT.lib:

Finished searching libraries
Generating clr ijw/native image
Generating non-SAFESEH image.
Importing assembly module c:\mbs7\sys\lib\expbin\csclib.netmodule
racustse.obj : error LNK2001: unresolved external symbol __iob
mbs4.lib(pform.obj) : error LNK2019: unresolved external symbol __pctype
mbs4.lib(pform.obj) : error LNK2019: unresolved external symbol
___mb_cur_max c:\mbs7\cust\demo03\beta\mbs7sys.exe : fatal error LNK1120: 3
unresolved externals

Those three symbols are not contained in the programs listed, and I do not
know where they come from. I assume that I somehow have the wrong combination
of default libraries, but I can not figure it out. Any help would be
appreciated. Thanks.
 
G

Gary Chang[MSFT]

Hi Richard,
racustse.obj : error LNK2001: unresolved external symbol __iob
mbs4.lib(pform.obj) : error LNK2019: unresolved external symbol
__pctype
mbs4.lib(pform.obj) : error LNK2019: unresolved external symbol
___mb_cur_max c:\mbs7\cust\demo03\beta\mbs7sys.exe :
fatal error LNK1120: 3 unresolved externals

Those symbols are referenced in the LIBCD.lib/LIBC.lib, I suggest you
remove the /nodefaultlib option in your cl command.

Those three symbols are not contained in the programs listed,
and I do not know where they come from. I assume that I
somehow have the wrong combination of default libraries,
but I can not figure it out.

You can check your VS2005's VC directory setting(Include files and Library
files), there may be some other includes\libs specified prior to the
default VC includes\libs, if so, you need to sort them back.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thanks for the reply Gary, I was eventually able to solve the problem. For
future reference, in case anyone is searching, the problem was this:

I was attempting to link in a library that was build with VS2003, and
apparently the obj files contain information about what library to use, and
so they brought in libc.lib, etc. When I rebuilt the library with .NET 2.0,
those libraries were no longer brought in, and the unresolved externals went
away.
 
G

Gary Chang[MSFT]

G

Guest

I am having the same problem as the OP, but in my case, no combination of
/NODEFAULTLIB and linking with explicit vs2005 libs is solving my problem.

I have a thirdpart library (PowerVR pvr toolkit library) that was apparently
compiled with some older version of the MS compiler. It has a DEFAULTLIB
comment for libc. However, the module I'm linking this in to requires
MSVCRT.lib (the MT DLL version of the CRT), and even though dumpbin -all
msvcrt.lib shows __iob is a symbol in that library, and the linker says it is
finding other symbols necessary in msvcrt.lib, it is sill complaining that
__iob is undefined.

I've been through this process with many other modules moving from vs2003 to
vs2005 and have always figured it out in the past and gotten everything to
compile and link. This is the first one I'm truly stuck on.

Any thoughts? It really should be enough to simply indicate
/NODEFAULTLIB:libc.lib and then make sure to link against msvcrt.lib, (or
msvcrtd.lib), so I'm quite confused.

Thanks.

-Eric Twietmeyer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top