I have an c++ application which uses ifstream.close() like this:
---------- #include <string> #include <iostream> using namespace std; void readMainConfig () { ifstream *config = new ifstream("x.cfg"); ... config->close(); delete config; } ----------cygwin can compile the .cpp files but when linking everything together, always "undefined reference" messages appear for the line with close():
----------g++ -mno-cygwin -w -march=i686 -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -I"./someDir" -c -o x1.o x1.cpp
... g++ -mno-cygwin -fPIC -shared -o xxx_i686.dll x1.o x2.o x3.o ... -lm x1.o: In function `_Z14readMainConfigv':x1.cpp:9: undefined reference to `std::basic_ifstream<char, std::char_traits<char> >::_close()'
----------When I use the -O2 g++ option, things go worse. Then "new ifstream("x.cfg")" causes undefined references to _open(...).
Under linux everything compiles fine without any substantial change, just the compile & link flags are different.
I am using the most current version of all cygwin packages. What am I doing wrong?
smime.p7s
Description: S/MIME cryptographic signature