我試過在C++中做一個簡單的Hello World,因爲我將在大約一個星期內在學校使用它。爲什麼我不能正確編譯它?爲什麼這個程序不能工作?
c:\Users\user\Desktop>cl ram.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
ram.cpp
ram.cpp(1) : fatal error C1083: Cannot open include file: 'iostream.h': No such
file or directory
c:\Users\user\Desktop>
這裏是ram.cpp
#include <iostream>
int main()
{
cout << "Hello World!";
return 0;
}
編輯:
我更新了我的代碼
#include <iostream>
using namespace std;
int main(void)
{
cout << "Hello World!";
return 0;
}
,仍然可以得到這個錯誤
ram.cpp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(323) : wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled. S
pecify /EHsc
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:ram.exe
ram.obj
不會向我們展示'ram.cpp'嗎? – asawyer 2012-03-22 21:57:56
對不起,我將它添加到 – netbyte 2012-03-22 22:18:13
你是否正在從一個正常的命令提示符或Visual Studio命令提示符運行此設置所有環境變量設置? – tinman 2012-03-22 22:41:49