Sign in to follow this  
skockara

[.net] multihreaded DLL v.s. Debug Single-threaded

Recommended Posts

skockara    122
I'm trying to make 2 seperate different codes put into one project file. One is using multihreaded DLL setting, other is using Debug Single-threaded setting. I'm getting some errors such as: unresolved external symbol "void __cdecl glmLinearTexture(struct GLMmodel *)" How can I solve this? There is nothing absent in iclude and link files. Note; using MS Visual C 6

Share this post


Link to post
Share on other sites
Cygon    1219
You are not supposed to do that :)

Every component of a project should use the same runtime library, so if you can, recompile all of your projects to use the same library, preferably choose "multithreaded dll" for release builds and "multithreaded debug dll" for debug builds (yes, that means you likely have to keep two seperate .lib files, usually the debug .lib is name mylib-d.lib or similar).

Otherwise, well, the errors are caused because two copies of the C runtime library are linked into your exe/dll and their names are, of course, colliding. If it's a 3rd party library some dumbass compiled in single-threaded mode it *might* be safe to throw out the single-threaded library using /NODEFAULTLIB (see msdn for details) on your project.

Hint: There's an option in the project settings (alt+f7) in the linker tab for that. The singlethreaded runtime for release builds is named "libc.lib" and the singlethreaded runtime for debug builds is named "libcd.lib"

-Markus-

Share this post


Link to post
Share on other sites
Cygon    1219
- Is your project actually set to multithreaded ?
- Is the other project really singlethreaded ?
- What are the exact error message you're getting ?

Share this post


Link to post
Share on other sites
skockara    122
Here are errors:

--------------------Configuration: toolsDENEMEbound - Win32 Debug--------------------
Linking...
dene.obj : error LNK2001: unresolved external symbol "void __cdecl tbMatrix(void)" (?tbMatrix@@YAXXZ)
dene.obj : error LNK2001: unresolved external symbol "void __cdecl glmFacetNormals(struct GLMmodel *)" (?glmFacetNormals@@YAXPAUGLMmodel@@@Z)
dene.obj : error LNK2001: unresolved external symbol "void __cdecl glmLinearTexture(struct GLMmodel *)" (?glmLinearTexture@@YAXPAUGLMmodel@@@Z)
dene.obj : error LNK2001: unresolved external symbol "void __cdecl glmDimensions(struct GLMmodel *,float *)" (?glmDimensions@@YAXPAUGLMmodel@@PAM@Z)
dene.obj : error LNK2001: unresolved external symbol "void __cdecl glmScale(struct GLMmodel *,float)" (?glmScale@@YAXPAUGLMmodel@@M@Z)
dene.obj : error LNK2001: unresolved external symbol "float __cdecl glmUnitize(struct GLMmodel *)" (?glmUnitize@@YAMPAUGLMmodel@@@Z)
dene.obj : error LNK2001: unresolved external symbol "struct GLMmodel * __cdecl glmReadOBJ(char *)" (?glmReadOBJ@@YAPAUGLMmodel@@PAD@Z)
dene.obj : error LNK2001: unresolved external symbol "void __cdecl gltxDelete(struct GLTXimage *)" (?gltxDelete@@YAXPAUGLTXimage@@@Z)
dene.obj : error LNK2001: unresolved external symbol "struct GLTXimage * __cdecl gltxReadRGB(char *)" (?gltxReadRGB@@YAPAUGLTXimage@@PAD@Z)
dene.obj : error LNK2001: unresolved external symbol "void __cdecl glmDraw(struct GLMmodel *,unsigned int)" (?glmDraw@@YAXPAUGLMmodel@@I@Z)
dene.obj : error LNK2001: unresolved external symbol "unsigned int __cdecl glmList(struct GLMmodel *,unsigned int)" (?glmList@@YAIPAUGLMmodel@@I@Z)
Debug/toolsDENEMEbound.exe : fatal error LNK1120: 11 unresolved externals
Error executing link.exe.

toolsDENEMEbound.exe - 12 error(s), 0 warning(s)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Make sure you understand what libraries are really used when linking, read the build log carefully. Add "/verbose:lib" to the linker if needed to get more output information.

Share this post


Link to post
Share on other sites
trevaaar    235
Two things:
a) the errors you're getting don't look like they're from the C runtime library. It looks more like something OpenGL-ish isn't being linked in properly.
b) this isn't related in any way to .NET, as you're using standard (unmanaged) C++ and a non-.NET-enabled compiler.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this