无法获取基本的C++;要在Windows 8上的Cygwin上编译的程序 我是CygWin,Windows和C++的新手,请跟我说。p> 这是我试图用CygWin .< /P>编译的C++程序(TITE.CPP)。 #include<iostream> using namepsace std; int main(void) { cout<<"Trying out CPP"<<endl; return 0; }

无法获取基本的C++;要在Windows 8上的Cygwin上编译的程序 我是CygWin,Windows和C++的新手,请跟我说。p> 这是我试图用CygWin .< /P>编译的C++程序(TITE.CPP)。 #include<iostream> using namepsace std; int main(void) { cout<<"Trying out CPP"<<endl; return 0; },c++,windows,g++,cygwin,C++,Windows,G++,Cygwin,FWIW,这是我做g++-v(我想是我电脑上安装的g++版本)时得到的结果 我做错了什么?你把名称空间错拼成名称空间我现在想自杀!!!它是在我纠正输入错误后编译的,但现在我无法运行可执行文件。在g++-c try.cpp-o try.o之后,当我执行/try.o时,它说-bash:./try.o:无法执行二进制文件你想要像g++-o try.exe try.cpp这样的东西。现在,你只生成了一个目标文件(-c意思是“编译但不链接”),并试图执行它。伙计,我现在觉得很愚蠢。无论如何,非常感谢你的及

FWIW,这是我做
g++-v
(我想是我电脑上安装的g++版本)时得到的结果


我做错了什么?

你把
名称空间
错拼成
名称空间

我现在想自杀!!!它是在我纠正输入错误后编译的,但现在我无法运行可执行文件。在
g++-c try.cpp-o try.o
之后,当我执行
/try.o
时,它说
-bash:./try.o:无法执行二进制文件
你想要像
g++-o try.exe try.cpp
这样的东西。现在,你只生成了一个目标文件(
-c
意思是“编译但不链接”),并试图执行它。伙计,我现在觉得很愚蠢。无论如何,非常感谢你的及时帮助。
$ g++ try.cpp
try.cpp:2: error: expected nested-name-specifier before "namepsace"
try.cpp:2: error: `namepsace' has not been declared
try.cpp:2: error: expected `;' before "std"
try.cpp:2: error: expected constructor, destructor, or type conversion before ';' token
try.cpp: In function `int main()':
try.cpp:5: error: `cout' undeclared (first use this function)
try.cpp:5: error: (Each undeclared identifier is reported only once for each function it appears in.)
try.cpp:5: error: `endl' undeclared (first use this function)
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /managed/gcc-build/final-v3-bootstrap/gcc-3.4.4-999/configure --verbose --program-suffix=-3 --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)