Reputation: 1267
I am new to Cygwin, Windows and C++, so please bear with me.
Here's the C++ program (try.cpp) I am trying to compile using Cygwin.
#include<iostream>
using namepsace std;
int main(void) {
cout<<"Trying out CPP"<<endl;
return 0;
}
Here's the version of Cygwin I am using (obtained using uname -r
on the cygwin terminal) : 1.7.17(0.262/5/3)
Here's the command I am using to compile my program:
g++ try.cpp
Here are the errors I get:
$ 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)
FWIW, here's what I get when I do g++ -v
(version of the g++ installed on my computer, I presume)"
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)
What am I doing wrong?
Upvotes: 1
Views: 318