【发布时间】:2012-01-30 20:11:10
【问题描述】:
我是 Linux Ubuntu 11.10 的新手,并且有基本的 C++ 知识。
我通过
安装了 g++sudo apt-get install build-essential
并在我的主目录中创建了一个目录 cpp。然后我在我的cpp目录中写了一个程序hello.cpp
#include <iostream>
using namespace std;
int main() {
cout << "Hello !" ; return 0;
}
并使用
编译g++ -W hello.cpp -o hello
程序编译没有任何错误/警告。当我尝试执行文件时
./hello.cpp
我收到错误消息:
line 3: using: command not found
line 6: syntax error near unexpected token `('
line 6: `int main() {'
我尝试查看很多帖子,但无法解决这个问题。我在 Windows 上有 MS VisualStudio,但我宁愿在 Ubuntu 上学习 C++。提前致谢。
【问题讨论】:
标签: c++ linux compilation