User forums > Using Code::Blocks

Codeblocks 12.11 LNK2005 errors using VS 2010

<< < (3/4) > >>

Biplab:
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).

Mug:
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.

stahta01:
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

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

Tim S.

Biplab:

--- Quote from: 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.

--- End quote ---

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.

Mug:

--- Quote from: Biplab on February 26, 2013, 02:31:10 am ---
--- Quote from: 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.

--- End quote ---

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.


--- End quote ---

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.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version