Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lots of unresolved externals 1

Status
Not open for further replies.

apatterno

Programmer
Nov 26, 2002
368
US
I wanted to use the _beginthreadex and _endthreadex C runtime functions, so to have them included in <process.h> I #defined _MT.

Now I get these errors:

connthread.obj : error LNK2001: unresolved external symbol __endthreadex
rbid.obj : error LNK2001: unresolved external symbol __beginthreadex

(Along with dozens of other unresolved externals)

These should be standard C library functions!! I have C library calls all over my program, but the presence of _beginthreadex and _endthreadex cause problems.

Do I need to link to some special multithread library in order to use _beginthreadex and _endthreadex?

I have tried manually linking with LIBCMT.LIB, but then I get hundreds of &quot;duplicate symbol&quot; errors.

If I remove the calls to _beginthreadex and _endthreadex, I do not receive the two errors listed above. But in any circumstance, I always get these errors whenever I #define _MT:

libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol __unlock
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol __unlock
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol __unlock
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol __unlock
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __unlock
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol __lock
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol __lock
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol __lock
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol __lock
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __lock
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___setlc_active
libcpmtd.lib(xstrcoll.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(_toupper.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(xwctomb.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active
libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol ___unguarded_readlc_active

What could be the problem?

Pulling my hair out.
Thanks in advance.

Will
 
I think you should build with option /MT as according to MSDN :

/MT Defines _MT so that multithread-specific versions of the run-time routines are selected from the standard header (.h) files. This option also causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib to resolve external symbols. Either /MT or /MD (or their debug equivalents /MTd or /MDd) is required to create multithreaded programs.

As you can see, _MT will be a result of building with option /MT. This is not exactly the same.
LIBCMT is the library you need.

/JOlesen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top