VS的 X64下的汇编编译

参考博客 VS编译64位汇编时报错:error C4235: 使用了非标准扩展: 不支持在此结构上使用“_asm”关键字 

在用VS2013编译内联汇编时,报如下错误:

错误    5    error C4235: 使用了非标准扩展: 不支持在此结构上使用“__asm”关键字

百度之后才知道原来VS在X64下不支持内联汇编了。

网上有多种方法解决这个问题,这里是参考的博客 VS编译64位汇编时报错:error C4235: 使用了非标准扩展: 不支持在此结构上使用“_asm”关键字 

首先安装Intel C++ Compiler XE。 下载Intel C++ Compiler XE,官网上不知道怎么下载,从一个百度网盘上下载下来的。这里自己又做了一个分享,文件有点大,2.8G 。    https://pan.baidu.com/s/1skU5Jjf

安装过程中要关闭 VS。

安装完之后参照上述博客,把平台工具集改为  Intel C++ Compiler XE 15.0

image

然后编译项目,我这里接着又报了另外一个错

error #10310: Failed to enable trusted storage check for licensing: WARNING: Enable Trusted Storage failed (flexnet error code 20). Trusted Storage based license could not be supported

然后去intel网站 https://software.intel.com/en-us/articles/error-trusted-storage-check 查到如下:

image

拷贝下来方便以后再次遇到:

Workaround for Windows* users:
Run Intel compiler as administrator once.
Steps:
1. Go to Start menu -> All Programs -> Intel® Parallel Studio XE -> Compiler and Performance Libraries -> Command Prompt with Intel Compiler.  Choose an appropriate command prompt.
2. In the command prompt window, run command:

runas /user:administrator "icl /v"

or

runas /user:administrator "ifort /v"

You will be prompted to input administrator’s password. This step will trigger the compiler to install the Windows service “FLEXnet Licensing Service 64”.

运行出来如下图:

image

运行的时候遇到输入密码不能为空的错误,需要为administrator设置一个密码,然后就可以成功了。

再编译就可以正常编译了。

image

这里编译的是一个lib文件,test工程引用这个lib,编译test的时候遇到了  “无法打开libmmd.dll” 的问题,这时候只需要把test的平台工具集也修改为Intel C++ Compiler XE 15.0 就可以了。

原文地址:https://www.cnblogs.com/betterwgo/p/8145746.html