Sign in to follow this  

Luabind linker errors in win32 application, but not console?.

This topic is 3489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm having trouble linking Luabind with a MSVC8 win32 project. I've tried everything I could think of, and nothing seems to solve the problem. I've tried both prebuilt Luabind binaries as well as building my own. Both the binaries I've build, and the project I'm building are using Multithreaded Debug DLL as the runtime library. Now the odd thing that I don't understand is that in just a normal console application my Luabind static library links just fine, and the sample program works as intended. However, when I try to link the Luabind binaries with my Win32 framework, using the exact same project settings, I get the following link errors.
1>libcmt.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(invarg.obj) : error LNK2005: __invalid_parameter_noinfo already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(fclose.obj) : error LNK2005: _fclose already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(fpinit.obj) : error LNK2005: __fltused already defined in a previous module
1>libcmt.lib(fpinit.obj) : error LNK2005: __ldused already defined in a previous module
1>libcmt.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRT.lib(cinitexe.obj)
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRT.lib(cinitexe.obj)
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRT.lib(cinitexe.obj)
1>libcmt.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRT.lib(cinitexe.obj)
1>libcmt.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRT.lib(MSVCR80.dll)
1>libcmt.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRT.lib(MSVCR80.dll)
1>msvcrtd.lib(MSVCR80D.dll) : error LNK2005: __invalid_parameter already defined in libcmt.lib(invarg.obj)
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
If anyone has any suggestions as to what I could try they would be greatly appreciated. I'm so frustrated with this. Everytime I think I have a handle on things, problems like this always prove me wrong.

Share this post


Link to post
Share on other sites
I've been browsing for lua a lot today and i think i read something about issues when linking lua against dynamic libraries today.
But don't take this to serious, it's been one of a million pieces of information i came over today .. so i might twist some facts.

Share this post


Link to post
Share on other sites
The library you're linking against is linking against a different version of the runtime libraries than your application is. Build the library to link against the same runtime as your app, otherwise you have to change your app to link against the same runtime the lib is.

Share this post


Link to post
Share on other sites
Quote:
Original post by RDragon1
The library you're linking against is linking against a different version of the runtime libraries than your application is. Build the library to link against the same runtime as your app, otherwise you have to change your app to link against the same runtime the lib is.


You missed the part where I said I was building the Luabind static library and my own project that I'm trying to use with Luabind using the exact same runtime library - Multithreaded Debug DLL.

Share this post


Link to post
Share on other sites
Quote:
Original post by RDragon1
The library you're linking against is linking against a different version of the runtime libraries than your application is. Build the library to link against the same runtime as your app, otherwise you have to change your app to link against the same runtime the lib is.


Which library are you referring to? I have tried to help out on this (we are on the same project team at school) and have run up against the same results. When building the luabind library as a win32 static library, it builds correctly. Then we linked against that with our console test app and it works. Using the same project settings but with a win32 app this time and it gave the above errors.

We've tried changing the runtime library from /MT to /MTd, even tried the dll versions and all we got was a variation on the number of errors.

Share this post


Link to post
Share on other sites

this is caused by different version of Run time libraries.
Check the user defined libraries you used, and make sure all of them is compiled using the same setting:

* select "Multi-threaded DLL (/MD)" for "Use MFC in a Shared DLL"
* select "Multi-threaded (/MT)" for "Use MFC in a Static Library"

Share this post


Link to post
Share on other sites

This topic is 3489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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