Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Mug on February 20, 2013, 09:41:08 pm

Title: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Mug on February 20, 2013, 09:41:08 pm
I'm attempting to compile the automatic generated wxWidgets program in codeblocks 12.11 with the compiler set to Visual Studio 2010 on Windows 7 but receive loads of link errors:

Code
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) already defined in libcpmtd.lib(xthrow.obj)|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z) already defined in libcpmtd.lib(xthrow.obj)|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) already defined in Test2App.obj|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) already defined in Test2Main.obj|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) already defined in Test2App.obj|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z) already defined in libcpmtd.lib(stdthrow.obj)|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in libcpmtd.lib(xlock.obj)|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: virtual __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::~basic_streambuf<char,struct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in libcpmtd.lib(cout.obj)|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "protected: __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::basic_streambuf<char,struct std::char_traits<char> >(void)" (??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ) already defined in libcpmtd.lib(cout.obj)|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: void __thiscall std::basic_ios<char,struct std::char_traits<char> >::clear(int,bool)" (?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z) already defined in libcpmtd.lib(cout.obj)|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: virtual __thiscall std::basic_ios<char,struct std::char_traits<char> >::~basic_ios<char,struct std::char_traits<char> >(void)" (??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in libcpmtd.lib(cout.obj)|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: virtual __thiscall std::basic_ostream<char,struct std::char_traits<char> >::~basic_ostream<char,struct std::char_traits<char> >(void)" (??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in libcpmtd.lib(cout.obj)|
etc.

I've read this can be solved by setting the /NODEFAULTLIB:library flag but I haven't found where to set this in 12.11. How can I get the program to link correctly?
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: cacb on February 20, 2013, 11:16:08 pm
You can do it as shown in the attachment, which shows a Release target. For the Debug target remove the 'd's in the library names.

Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Mug on February 21, 2013, 09:41:49 am
Thanks, I'm slowly getting there... However, I'm still getting some errors.

These are my current settings:
Settings->Compiler...->Search Directories->Compiler
  C:\Program Files\Microsoft SDKs\Windows\v7.1\Include
  C:\Program Files\Microsoft Visual Studio 10.0\VC\include

Settings->Compiler...->Search Directories->Linker
  C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib
  C:\Program Files\Microsoft Visual Studio 10.0\VC\lib

Settings->Compiler...->Search Directories->Resource Compiler
  C:\Program Files\Microsoft SDKs\Windows\v7.1\Include
  C:\Program Files\Microsoft Visual Studio 10.0\VC\include
  
Settings->Compiler...->Linker settings->Other linker options:
    /NODEFAULTLIB:libcpmtd.lib
    /NODEFAULTLIB:LIBCMTD.lib

These are my steps to produce the errors
1. Start codeblocks 12.11.
2. Click "Create a new project".
3. Double click "wxWidgets Project".
4. Select wxWidgets 2.9.x (SVN Version).
5. Click "Next".
6. Enter Project title: "Test2".
7. Click "Next".
8. Click "Next*.
9. Select "wxSmith" and "Dialog Based".
10. Click "Next".
11. Accept wxWidgets' location: as "$(#wx)".
12. Click "Next".
13. Compiler is "Microsoft Visual C++ 2010 and both "Release" and "Debug" boxes are checked.
14. Click "Next".
15. Only "Enable Unicode" is checked.
16. Click "Next".
17. On the messagebox, click "No" to continue with Multi-threaded Static CRT mode.
18. Select wxHTML, wxJpeg and wxTiff.
19. Click "Finish".
20. Build the application.

These are the errors I get  ???
Code
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) already defined in Test2App.obj|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) already defined in Test2Main.obj|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) already defined in Test2App.obj|
bin\Debug\Test2.exe||fatal error LNK1169: one or more multiply defined symbols found|
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: cacb on February 21, 2013, 07:52:58 pm
Thanks, I'm slowly getting there... However, I'm still getting some errors.

Because you didn't follow the previous advice as shown.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Mug on February 21, 2013, 08:35:55 pm

Because you didn't follow the previous advice as shown.

Could you be more specific?
Of course I tried with all the files you showed in the "Other linker options", but since I got the same errors, I see no point in keeping them there. Anyway, I put them back in and I still get the errors.

[attachment deleted by admin]
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: stahta01 on February 22, 2013, 04:14:35 am
You are supposed to change the Project Options instead of Global Compiler Options in nearly all cases like this.

Tim S.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: cacb on February 22, 2013, 08:38:57 am
You are supposed to change the Project Options instead of Global Compiler Options in nearly all cases like this.

Tim S.

And actually exclude the suggested libraries, instead of other ones.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Mug on February 22, 2013, 09:18:17 am
OK, thanks. That just goes to show that I don't have a clue how to set up code::blocks and really would appreciate some help.

So, I started again from scratch and left the Global Compiler Options alone.
Now, instead of 4 errors I get over 50  ???

Code
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) already defined in Test2App.obj|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) already defined in Test2Main.obj|
msvcprtd.lib(MSVCP100D.dll)||error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) already defined in Test2App.obj|
wxbase29ud.lib(mimetype.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(ipcbase.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(textfile.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(base64.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(mimecmn.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(fileback.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(dde.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(fileconf.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(languageinfo.obj)||error LNK2019: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) referenced in function __ehhandler$??1?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@XZ|
wxbase29ud.lib(regconf.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(stdpaths.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(longlong.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(process.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(debughlp.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(datetimefmt.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(crashrpt.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(stackwalk.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(any.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(xlocale.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(dir.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(wxcrt.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(datetime.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(datstrm.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(mstream.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(convauto.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(timercmn.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(ffile.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(stopwatch.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(variant.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(wfstream.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(hash.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(txtstrm.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(textbuf.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(fmapbase.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(encconv.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(stream.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(platinfo.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(utilsexc.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(registry.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(file.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(filename.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(filesys.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(filefn.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(uri.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(time.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(sysopt.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
wxbase29ud.lib(tokenzr.obj)||error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 21 seconds) ===|

Here are my library settings
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: cacb on February 22, 2013, 06:06:50 pm
You have got to pay more attention to the basic instructions given. You keep ignoring them, that is why you are having problems.

You were assisted with this
You can do it as shown in the attachment, which shows a Release target. For the Debug target remove the 'd's in the library names.

But you chose to exclude other libraries. When you complained about further errors, you were again hinted at the cause
Because you didn't follow the previous advice as shown.

You then did the opposite of the advice given (observe Release and Debug), and for some unexplained reason chose to explicitely include another MS library and at the same time declare it as excluded from the list of default linked libraries. That makes no sense. Try following the advice given.

I'll gladly assist, but only if you follow the advice.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Mug on February 25, 2013, 09:01:10 am
For you, this may all seem terribly simple, but I can assure you, I've spent many hours just trying to get a wizard-generated program to compile.
I am completely new to codeblock, and all I expect is to be able to compile the simplest, auto-generated project.

My first mistake was that I did not realize you were using the Project Options instead of the Global Compiler Options. I thought you were using another version of codeblocks because I saw no mention of VC++ 2010 in your screen capture. Also, since I didn't recognize your capture, I thought it was from another version of codeblocks. I think this mistake is easy to oversee, especially if you are completely new to codeblocks.

Anyway, I have now done a fresh install, after first removing codeblocks from %APPDATA%\
I have added EXACTLY what your first screen capture shows, nothing else. As you can see, there is an include file missing, but I don't dare add this for fear of you telling me I have not followed your instructions. So please, tell me what I should do next.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Biplab on February 25, 2013, 11:50:10 am
First you have to understand a bit about the different options you have in MSVC.

1) If you use /MT as compiler and linker option, your program is linked statically with MSVC runtime. In this case your program will be linked with libcmt.lib . You MUST use same compiler and linker options (/MT in this case) for all modules/libraries that are being linked.
2) If you use /MD as compiler and linker option, your program is linked dynamically with MSVC runtime. In this case your program will be linked with msvcrt.lib . Again you MUST use same compiler and linker options (/MD in this case) for all modules/libraries that are being linked. In this case you can use /NODEFAULTLIB:/libcmt.lib in the linker option.

Now from the step 17 of your post I see you are using statically linked wxwidgets library, i.e. option 1 above. In that case you should make sure your wxwidgets library has been built with same flag (/MT - statically against MSVC runtime).
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Mug on February 25, 2013, 02:08:45 pm
Thank you for your reply and taking the time to study what I'm trying to do. Yes, I am only interested in a static build. I believe wxWidgets is correctly built.
From within visual studio I used batch build with all selected and repeated compiling until I got no errors. That went very smoothly.

I can also compile a staticly linked wxProject without any problem from within VS2010. That also went very smoothly, thanks to excellent documentation. However, I am at a total loss of how to compile the same files within code::blocks. Believe me, I've spent hours trying to get code::blocks to work, but I'm getting to the point where I'm losing complete interest. I come here for help, get told off for doing something I thaught I was doing right, had everything down to 2 errors, but now can't even compile any more. Yes I know how I can get rid of the include errors, but I was told to only do what I was told. So be it. I just hope someone will be kind enough to help me along. I've also spent days searching for information but have only found outdated documentation which was no help to me at all. I have installed / de-installed code::blocks well over a dozen times. I have never encounted such a badly documented (at least for VS2010) and confusing environment. OK, I know it's free, and from what I've seen I do like wxSmith, but I'm slowly asking myself why I've wasted so many days on trying to get this environment to work with Visual Studio.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: stahta01 on February 25, 2013, 04:03:00 pm
Read this link; I know it won't help you, much.

http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)

This is really a topic more appropriate to wxForum and this site, together. You almost need two separate threads.
One for wxWidgets questions and one for CB Questions.

http://forums.wxwidgets.org/viewforum.php?f=19&sid=7dd1b87ec298c9720a6da33f1ed3a982 (http://forums.wxwidgets.org/viewforum.php?f=19&sid=7dd1b87ec298c9720a6da33f1ed3a982)

Tim S.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Biplab on February 26, 2013, 02:31:10 am
Thank you for your reply and taking the time to study what I'm trying to do. Yes, I am only interested in a static build. I believe wxWidgets is correctly built.
From within visual studio I used batch build with all selected and repeated compiling until I got no errors. That went very smoothly.

If you have used Visual Studio to build wxwidgets then that indicates you have built wxwidgets against dynamic MSVC runtime. To solve this problem Click on the Yes button in step 17. Wizard will do the rest. And DO NOT customise any other compiler/linker options.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Mug on February 26, 2013, 10:10:54 am
Thank you for your reply and taking the time to study what I'm trying to do. Yes, I am only interested in a static build. I believe wxWidgets is correctly built.
From within visual studio I used batch build with all selected and repeated compiling until I got no errors. That went very smoothly.

If you have used Visual Studio to build wxwidgets then that indicates you have built wxwidgets against dynamic MSVC runtime. To solve this problem Click on the Yes button in step 17. Wizard will do the rest. And DO NOT customise any other compiler/linker options.


Well, thank you very, very much. That was terribly simple after all the frustration I've had over the last few days. You've made my day.  :)

For the time being, that will certainly get me started, but, if I dare ask, what steps do I need to take to use static CRT mode? Or is this a wxWidgets question? I thought if I used batch build in VS2010 to build wxWidgets then all the libraries gets compiled. It certainly took a very long time! Is there any way I can check if the static libraries are there?

Anyway, you can't imagine how happy I am now that I can at last take a look at what code:blocks can do. Thank you.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Biplab on February 26, 2013, 01:09:49 pm
That was terribly simple after all the frustration I've had over the last few days.
Now you know that wizard shows that message for a reason. As long as you don't mix & match CRT, you should not see these errors.

For the time being, that will certainly get me started, but, if I dare ask, what steps do I need to take to use static CRT mode?
To build wxwidgets with static CRT, you need to do the following. In Visual Studio click Project -> Properties -> Configuration Properties -> C/C++ -> Runtime Library & select Multi-threaded/Multi-threaded Debug option. Click OK to close dialog. Do this for all projects.

Alternatively in the command prompt add the following to compile it with static CRT.
Code
nmake /f makefile.vc RUNTIME_LIBS=static <Other Options>

Is there any way I can check if the static libraries are there?
You can check it by issuing following command
Code
D:\Projects\Test1\Debug>dumpbin /all Test1.lib | find /i "/DEFAULTLIB"
  00000000: 20 20 20 2F 44 45 46 41 55 4C 54 4C 49 42 3A 22     /DEFAULTLIB:"
   /DEFAULTLIB:MSVCRTD
   /DEFAULTLIB:OLDNAMES

D:\Projects\Test1\Debug>
As you can see this shows static library Test1.lib is dynamically linked against MSVCRTD.lib. In this case if you want to link any app against Test1.lib you have to use /MTd as compiler and linker option.

When Test1.lib is linked against static MSVC runtime, it will show libcmt[d].lib in output.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Mug on February 26, 2013, 02:09:57 pm
Biplab, thank you very much for your very informative and helpful information. Now I understand everything much better.

I think it's best not to start messing with compiler settings now everything is working, at least for the time being. You have been most helpful and I'm extremely greatful to you. At last I can start concentrating on what I originally set out to do, and that is learning how to use wxWidgets. I had almost given up on code::blocks.
Title: Re: Codeblocks 12.11 LNK2005 errors using VS 2010
Post by: Biplab on February 26, 2013, 02:25:58 pm
Biplab, thank you very much for your very informative and helpful information. Now I understand everything much better.

I think it's best not to start messing with compiler settings now everything is working, at least for the time being. You have been most helpful and I'm extremely greatful to you. At last I can start concentrating on what I originally set out to do, and that is learning how to use wxWidgets. I had almost given up on code::blocks.

You're most welcome. Enjoy Code::Blocks. :)

For future problems, try to post as much information as possible. That helps others debug the issue easily.