我正在尝试学习 C++,但我什至无法使 cplusplus.org 中的第一个(hello world)示例与g++命令或c++. 我像示例一样创建了一个文件并运行g++ myfile,然后./myfile.
我遇到权限问题,然后我使用chmod +x myfile,权限问题消失了,但发生了这个问题:
gzuspower@gzuspower:~/Desktop$ ./4
./4: line 1: //myfirst: No such file or directory
./4: line 4: syntax error near unexpected token `('
./4: line 4: `int main ()'
Run Code Online (Sandbox Code Playgroud)
我打电话给我的文件,4因为这是我的第四次尝试。这是在Xubuntu 16.04上。重复的问题答案不起作用我试过.c,.cpp,作为文件扩展名并尝试了firstc++(我的第一次尝试文件)而不是4(我的第四次尝试文件),但没有任何效果。我将尝试不同形式的 hello-world 代码。