Unresolved 'C' functions in linking.

K

Kevin Burton

I am trying to use managed C++ but I am getting the
following link errors:

Metadata
file 'D:\Projects\Visa\AddressVerification\AddressVerificat
ionTest\bin\Debug\AddressVerificationInterface.dll' could
not be found
AddressVerificationInterface error LNK2001: unresolved
external symbol "void * __cdecl operator new(unsigned
int)" (??2@$$FYAPAXI@Z)
AddressVerificationInterface error LNK2001: unresolved
external symbol "void __cdecl operator delete(void *)" (??
3@$$FYAXPAX@Z)
AddressVerificationInterface error LNK2001: unresolved
external symbol "char * __cdecl strncpy(char *,char const
*,unsigned int)" (?strncpy@@$$J0YAPADPADPBDI@Z)
AddressVerificationInterface error LNK2001: unresolved
external symbol "void * __cdecl memset(void *,int,unsigned
int)" (?memset@@$$J0YAPAXPAXHI@Z)
AddressVerificationInterface fatal error LNK1120: 4
unresolved externals


These all seem like 'C' functions that should be part of
the CRT. How do I resolve these? Does C++ not know the
difference between a managed new and an unmanaged new?
What about strncpy? and memset?

Thank you.

Kevin
 
D

Daniel Tomko [MSFT]

--------------------
From: "Kevin Burton" <[email protected]>
Subject: Unresolved 'C' functions in linking.
Date: Wed, 6 Aug 2003 13:52:35 -0700
Message-ID: <[email protected]>

I am trying to use managed C++ but I am getting the
following link errors:

Metadata
file 'D:\Projects\Visa\AddressVerification\AddressVerificat
ionTest\bin\Debug\AddressVerificationInterface.dll' could
not be found
AddressVerificationInterface error LNK2001: unresolved
external symbol "void * __cdecl operator new(unsigned
int)" (??2@$$FYAPAXI@Z)
AddressVerificationInterface error LNK2001: unresolved
external symbol "void __cdecl operator delete(void *)" (??
3@$$FYAXPAX@Z)
AddressVerificationInterface error LNK2001: unresolved
external symbol "char * __cdecl strncpy(char *,char const
*,unsigned int)" (?strncpy@@$$J0YAPADPADPBDI@Z)
AddressVerificationInterface error LNK2001: unresolved
external symbol "void * __cdecl memset(void *,int,unsigned
int)" (?memset@@$$J0YAPAXPAXHI@Z)
AddressVerificationInterface fatal error LNK1120: 4
unresolved externals


These all seem like 'C' functions that should be part of
the CRT. How do I resolve these? Does C++ not know the
difference between a managed new and an unmanaged new?
What about strncpy? and memset?

Thank you.

Kevin

There could be a number of things going on here, and just the error message
isn't enough to figure it out in this case. What options are being passed
to the linker? Is /nodefaultlib one of them? That could be the cause of the
unresolved externals. As for the first error, it sounds like the location
of the DLL is not on the assembly search path. Try adding /AI<location of
assembly> to the command line.

Please send your compile and link command line options, and I might be able
to help further.
 
K

Kevin Burton

Thank you for your response:

Here is my compile:

/Od /I "C:\Program
Files\PB\Finalist\Include" /AI "d:\Projects\Visa\AddressVer
ification\AddressVerificationInterface\Debug" /D "WIN32" /D
"_DEBUG" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MTd /GS /Yu"st
dafx.h" /Fp"d:\Projects\Visa\AddressVerification\AddressVer
ificationInterface\Debug/AddressVerificationInterface.pch"
/Fo"d:\Projects\Visa\AddressVerification\AddressVerificatio
nInterface\Debug/" /Fd"d:\Projects\Visa\AddressVerification
\AddressVerificationInterface\Debug/vc70.pdb" /W3 /nologo /
c /Zi /clr /TP /FU "C:\WINNT\Microsoft.NET\Framework\v1.1.4
322
\mscorlib.dll" /FU "C:\WINNT\Microsoft.NET\Framework\v1.1.4
322
\System.dll" /FU "C:\WINNT\Microsoft.NET\Framework\v1.1.432
2\System.XML.dll"

Here is the link:

/OUT:"d:\Projects\Visa\AddressVerification\AddressVerificat
ionInterface\Debug/AddressVerificationInterface.dll" /INCRE
MENTAL /NOLOGO /LIBPATH:"C:\Program
Files\PB\Finalist\LIB\\" /DLL /DEBUG /ASSEMBLYDEBUG /PDB:"d
:\Projects\Visa\AddressVerification\AddressVerificationInte
rface\Debug/AddressVerificationInterface.pdb" /FIXED:No
nochkclr.obj mscoree.lib pclnt.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib

Kevin
 
D

Daniel Tomko [MSFT]

--------------------
From: "Kevin Burton" <[email protected]>
Sender: "Kevin Burton" <[email protected]>
Subject: RE: Unresolved 'C' functions in linking.
Date: Fri, 8 Aug 2003 08:35:10 -0700
Message-ID: <[email protected]>

Thank you for your response:

Here is my compile:

/Od /I "C:\Program
Files\PB\Finalist\Include" /AI "d:\Projects\Visa\AddressVer
ification\AddressVerificationInterface\Debug" /D "WIN32" /D
"_DEBUG" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MTd /GS /Yu"st
dafx.h" /Fp"d:\Projects\Visa\AddressVerification\AddressVer
ificationInterface\Debug/AddressVerificationInterface.pch"
/Fo"d:\Projects\Visa\AddressVerification\AddressVerificatio
nInterface\Debug/" /Fd"d:\Projects\Visa\AddressVerification
\AddressVerificationInterface\Debug/vc70.pdb" /W3 /nologo /
c /Zi /clr /TP /FU "C:\WINNT\Microsoft.NET\Framework\v1.1.4
322
\mscorlib.dll" /FU "C:\WINNT\Microsoft.NET\Framework\v1.1.4
322
\System.dll" /FU "C:\WINNT\Microsoft.NET\Framework\v1.1.432
2\System.XML.dll"

Here is the link:

/OUT:"d:\Projects\Visa\AddressVerification\AddressVerificat
ionInterface\Debug/AddressVerificationInterface.dll" /INCRE
MENTAL /NOLOGO /LIBPATH:"C:\Program
Files\PB\Finalist\LIB\\" /DLL /DEBUG /ASSEMBLYDEBUG /PDB:"d
:\Projects\Visa\AddressVerification\AddressVerificationInte
rface\Debug/AddressVerificationInterface.pdb" /FIXED:No
nochkclr.obj mscoree.lib pclnt.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib

Kevin

Yuck. I'm still not seeing anything obvious. Is it neceessary that you use
precompiled headers? If not, you may want to remove them and compile
normally. In general, it just reduces complication. It looks like the first
error is trying to do a metadata search on the DLL you are creating. Why is
this? I don't see that DLL listed anywhere on the linker line other than
the /OUT argument. Is the source code for the DLL self referencing in a
using statement? As for the CRT symbols, try adding msvcrt.lib to the
linker command line.

Sorry about not being of much help, but I'm grasping at straws... I haven't
been able to reproduce this on my end, so I'm just going on what I see here.
 

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