我使用 cl 命令编译了一个 cpp 文件:
cl test.cpp //the generated test.exe can work well
然后我用了另一种方式:
cl /Fa /c test.cpp //generate a test.asm assembly file
ml test.asm // there failed!!!
为什么?如何解决?
源代码:
//:test.cpp
#include<iostream>
using namespace std;
int main()
{
cout<<"hello\n";
}
错误信息:
组装:test.asm test.asm(1669):致命错误 A1010:不匹配的块嵌套
: ??$?6U?$char_trait s@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z
今天我用c写了另一个代码
//test.cpp
#include<stdio.h>
void main()
{
printf("hello");
}
然后我编译代码
cl /Fa /c test.cpp
ml test.asm //ok!
这可能是 C 和 C++ 的区别。这让我困惑了几天。:(
如何解决?请帮我。