How do I force Visual Studio 2010 to link against x64 runtime libraries?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Ive hoped to get an answer over at http://stackoverflow.com/questions/10849420/how-do-i-force-visual-studio-2010-to-use-x64" target="_blank" title="How do I force Visual Studio 2010 to use x64?
stackoverflow , unfortunatly I didnt receive much attention, so I thought I ask in here too.
Whenever I create a new project and want to compile everything into a x64 binary I need to change the settings. If I remember to do so immediatly after creating an empty project Im fine and creating a new x64 platform will work as one might think.<br/>
BUT if I forget to change it and try to compile my application in x86 (using a x64 compiled library) Visual Studio doesnt change ALL of its inner settings when creating a new x64 platform.<br/>
This all ends in error messages like:
<pre class="prettyprint libcpmtd.lib(uncaught.obj) : fatal error LNK1112: module machine type x64 conflicts with target machine type X86[/code]
<pre class="prettyprint libcpmtd.lib(cout.obj) : fatal error LNK1112: module machine type x64 conflicts with target machine type X86[/code]
Now the fix ther you see suggested everywhere is to change the project setting for the target machine, unfortunatly this already gets changed with the creation of a new x64 platform: <span style="font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; font-size:14px; text-align:left; background-color:#eeeeee MachineX64
(/MACHINE:X64)
A few information that might be relevant:

Im linking the runtime library statically (/MTd).Im using Visual Studio Ultimate (being a student ftw!).Im running Window 7 x64.The include and library paths get updated correctly to the location of the x64 libraries.
So from what I understand or conclude is that VS somehow internally chooses the x86 static runtime library whenever you compile first and afterwards it doesnt change that decision to use the x64 static runtime library.
(Why is there no linker/compiler forum?)

View the full article
 
Back
Top