From: SourceForge.net <no...@so...> - 2009-03-12 16:03:58
|
Bugs item #2373234, was opened at 2008-12-02 04:13 Message generated for change (Comment added) made by eldhaberunit You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2373234&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: MinGW Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mark Cave-Ayland (cavey) Assigned to: Nobody/Anonymous (nobody) Summary: Latest MingW download breaks g++ -ansi option Initial Comment: Hi everyone, I've been using a MingW 4 installation for a couple of years, and have recently started again by downloading the Windows installer and grabbing the latest versions of MingW and MSYS at the time of writing. However, I have noticed a regression in that one of the libraries I regularly compile with MingW now fails with the following error: In file included from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/ c++/3.4.5/bits/postypes.h:46, from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/ c++/3.4.5/iosfwd:50, from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/ c++/3.4.5/ios:44, from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/ c++/3.4.5/ostream:45, from C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/ c++/3.4.5/iostream:45, from test.cpp:1: C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/cwchar:161: error: `::swprintf' has not been declared C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/cwchar:168: error: `::vswprintf' has not been declared With some detective work, I managed to find out that the problem is due to the fact that g++ is invoked in ANSI mode with the -ansi parameter that the compilation fails. The error can easily be reproduced by compiling a simple "Hello World" program called test.cpp like this: #include <iostream> using namespace std; main() { cout << "Hello World"; } with the following command line: g++ -ansi -o test.exe test.cpp After a bit of fiddling, I found that I was able to get my test program above to compile in ANSI mode by loading include/c++/3.4.5/cwchar and commenting out the lines containing "using ::swprintf" and "using ::vswprintf". I think that this related to the fact that the swprintf() and vswprintf() functions in wchar.h are surrounded by an "#ifndef __STRICT_ANSI__" declaration; however I am not sure whether or not surrounding the "using" lines mentioned above with the same declaration is the correct thing to do in C++. Many thanks, Mark. ---------------------------------------------------------------------- Comment By: eldhaber unit (eldhaberunit) Date: 2009-03-13 00:03 Message: the modification i made fixed the problem after i surrounded using ::swprintf and using ::vswprintf by #ifndef __STRICT_ANSI__ ---------------------------------------------------------------------- Comment By: eldhaber unit (eldhaberunit) Date: 2009-03-12 23:59 Message: hi there! in file cwchar, i enclosed using ::swprintf and using ::vswprintf statements with #ifndef __STRICT_ANSI__ and #endif after doing this i was able to compile the above code in ANSI mode ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2373234&group_id=2435 |