VC9: LINK : warning LNK4068: /MACHINE not specified; defaulting to X86

原创 2012年03月23日 15:06:18

当把32位程序改成X64的配置编译后,可能会出现错误:

fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' 

通常是因为某些编译单元被编译成了X86的机器码,进一步的原因是编译选项中缺少
/MACHINE,默认会选择X86;在属性中的link面板中加入/MACHINE:X64
即可。

 

The error is explicit, you are trying to link libraries that were compiled with different CPU targets. An executable image can only contain pure x86 (32-bit) or pure x64 (64-bit) code. Mixing is not possible.

You change the target CPU by creating a new configuration for the project, only changing the linker setting isn't enough. Build + Configuration Manager, Active solution platform combo on upper right, choose New and select x64. That creates a new configuration with several modified project settings, most importantly the compiler that will be used.

Beware that prior to VS2010, the 64-bit compilers are not installed by default. If you don't see x64 in the platform combo then you'll need to re-run setup.exe and turn on the option to install the 64-bit compilers. Then also re-run any service pack installer you may have applied.

A possible approach with less pain points is to use the 32-bit version of the library.

bumped into this too and found a solution.

First on how I got into this problem. I have a project which builds in x86. Then I use the Configuration Manager to add x64, and I hit this problem.

By looking at BuildLog.htm carefully, I see both of these listed as linker options: /MACHINE:X64
/machine:X86

I can't find any where in the Property Pages dialog where I can change this, so I open up the .vcproj file and look for the appropriate line and change it to: AdditionalOptions=" /STACK:10000000 /machine:x64 /debug"

 

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

OpenCV3.0 或OpenCV3.1 与cuda编译出现LINK: warning LNK4044: 无法识别的选项/LC:/Program Files/XXXXXXXX/lib/x64

OpenCV3.0 或OpenCV3.1 与cuda编译出现LINK: warning LNK4044: 无法识别的选项“/LC:/Program Files/NVIDIA GPU Computing...

Error_9_fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

Error Description: Error_9_fatal error LNK1112: module machine type 'X86'conflicts with target mach...

Qt 使用qmake 遇到 warning LNK4042: object specified more than once; extras ignored 错误的处理办法

当同一个工程下出现两个文件名相同的cpp文件而又没办法修改文件名时,编译器链接时会报错链接错误 lnk:4042 对于qt的工程该如何解决呢? 网上有种说法: 在工程pro中加入 CONF...

LINK : warning LNK4098: 默认库“LIBCMTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library .

以前经常遇到这个警告信息,因为运行并没有什么问题,所以也没深究。但是耿耿于怀那个“ 0 个错误,0 个警告”的成功提示,在网上搜了一下。原来问题出在默认库的引用选择上。   VS2008,项目——...

LINK : warning LNK4098: 默认库“MSVCRTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library

链接时警告: LINK : warning LNK4098: 默认库“MSVCRTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library LINK : warning LNK409...

(转)LINK : warning LNK4098: 默认库“LIBCMTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library

LINK : warning LNK4098: 默认库“LIBCMTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library  以前经常遇到这个警告信息,因为运行并没有什么...

Windows2003 IIS6 + PHP-5.3.6-nts-Win32-VC9-x86.zip

操作系统:WIN2003 Server Standard Edition Service Pack2 下载软件:Microsoft Visual C++ 2008 Redistributable Pa...

LINK : warning LNK4098: 默认库“LIBCMTD”与其他库的使用冲突

以前经常遇到这个警告信息,因为运行并没有什么问题,所以也没深究。但是耿耿于怀那个“ 0 个错误,0 个警告”的成功提示,在网上搜了一下。原来问题出在默认库的引用选择上。VS2008,项目——属性——配...

“warning C4996: 'fopen': This function or variable may be unsafe”和“LINK : fatal error LNK1104”的解决办法

程序有时编译出现警告C4996,报错:  warning C4996: 'fopen': This function or variable may be unsafe. Consider using...
  • dcrmg
  • dcrmg
  • 2016-12-31 12:47
  • 401

LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:librar

编译时候发现如下警告,虽然问题不大,但是出现警告多少不舒服,于是搜索了一下。 Linking... LINK : warning LNK4098: defaultlib "LIBC" confli...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)