This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

g++ include string.h


Hi there,

i'm kind of newbee to c++ programming and try to do my first steps with the gcc in delivered with cygwin.

I'd like to include the string.h into my little program but it wasn't found as the compiler doesn't accept my string declarations.

here's my program and what the compiler sais:
*****************************************************

// reading a text file
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <windows.h>
#include <string.h>
#include <string>

string FILE_POSTFIX = "myfile.txt";

int main (int argc, char** argv) {
string filename = FILE_POSTFIX;
string output;
ifstream in (filename) ;
while (in){
in >> output ;
cout << output << endl;
}
}
*********************************************************
g++ -v -Wall -Wno-deprecated tryme.cpp -o testthings.exe
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld --with-gnu-as --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/sbin --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,f77,pascal,java,objc --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --enable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --disable-win32-registry --enable-java-gc=boehm --disable-hash-synchronization --verbose --target=i686-pc-cygwin --host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/cc1plus.exe -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../include/w32api -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/lib/../../include/w32api tryme.cpp -D__GNUG__=3 -quiet -dumpbase tryme.cpp -auxbase tryme -Wall -Wno-deprecated -version -o /cygdrive/d/TMP/ccRWM9yi.s
GNU C++ version 3.3.1 (cygming special) (i686-pc-cygwin)
compiled by GNU C version 3.3.1 (cygming special).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32700
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/i686-pc-cygwin/include"
ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/3.3.1
/usr/include/c++/3.3.1/i686-pc-cygwin
/usr/include/c++/3.3.1/backward
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include
/usr/include
/usr/include/w32api
End of search list.
tryme.cpp:9: error: syntax error before `=' token
tryme.cpp: In function `int main(int, char**)':
tryme.cpp:12: error: `string' undeclared (first use this function)
tryme.cpp:12: error: (Each undeclared identifier is reported only once for each
function it appears in.)
tryme.cpp:12: error: syntax error before `=' token
tryme.cpp:14: error: `filename' undeclared (first use this function)
tryme.cpp:16: error: `output' undeclared (first use this function)
make: *** [testthings.exe] Error 1


Compilation exited abnormally with code 2 at Mon May 17 18:56:50


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]