_MSC_VER not defined on mingw32
I downloaded and unzipped the latest boost (1.30.0) and tried using it in a simple file like this: #include <boost/smart_ptr.hpp> int main() { boost::shared_ptr<int> p(new int); return 0; } I compiled it, and got the following output: gcc -c -Wall -W -Werror -Wundef -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wconversion -idirafter c: /programming/lib/kakefisk -Ic:/programming/boost_1_30_0 -O3 -fomit-frame-pointer -ffast-math btest.cpp -o btest.o In file included from c:/programming/boost_1_30_0/boost/scoped_ptr. hpp:16, from c:/programming/boost_1_30_0/boost/smart_ptr.hpp: 17, from btest.cpp:1: c:/programming/boost_1_30_0/boost/checked_delete.hpp:4:5: "_MSC_VER" is not defined In file included from c:/programming/boost_1_30_0/boost/shared_ptr. hpp:26, from c:/programming/boost_1_30_0/boost/smart_ptr.hpp: 19, from btest.cpp:1: c:/programming/boost_1_30_0/boost/throw_exception.hpp:4:5: "_MSC_VER" is not defined In file included from c:/programming/boost_1_30_0/boost/shared_ptr. hpp:27, from c:/programming/boost_1_30_0/boost/smart_ptr.hpp: 19, from btest.cpp:1: c:/programming/boost_1_30_0/boost/detail/shared_count.hpp:4:5: "_MSC_VER" is not defined In file included from c: /programming/boost_1_30_0/boost/detail/shared_count.hpp:27, from c:/programming/boost_1_30_0/boost/shared_ptr. hpp:27, from c:/programming/boost_1_30_0/boost/smart_ptr.hpp: 19, from btest.cpp:1: c:/programming/boost_1_30_0/boost/detail/lightweight_mutex.hpp:4:5: "_MSC_VER" is not defined In file included from c: /programming/boost_1_30_0/boost/detail/lightweight_mutex.hpp:68, from c: /programming/boost_1_30_0/boost/detail/shared_count.hpp:27, from c:/programming/boost_1_30_0/boost/shared_ptr. hpp:27, from c:/programming/boost_1_30_0/boost/smart_ptr.hpp: 19, from btest.cpp:1: c:/programming/boost_1_30_0/boost/detail/lwm_nop.hpp:4:5: "_MSC_VER" is not defined In file included from c:/programming/boost_1_30_0/boost/smart_ptr.hpp: 19, from btest.cpp:1: c:/programming/boost_1_30_0/boost/shared_ptr.hpp:390:60: "BOOST_MSVC" is not defined mingw32-make.exe: *** [btest.o] Error 1 I also tried compiling after setting the following in <boost/config/user.hpp> with no apparent effect: // define this to locate a compiler config file: #define BOOST_COMPILER_CONFIG <boost/config/compiler/gcc.hpp> // define this to locate a stdlib config file: #define BOOST_STDLIB_CONFIG <boost/config/stdlib/libstdcpp3.hpp> // define this to locate a platform config file: #define BOOST_PLATFORM_CONFIG <boost/config/platform/win32.hpp> Does anyone have any ideas as to where the problem might lie?
omnizionic wrote:
I downloaded and unzipped the latest boost (1.30.0) and tried using it in a simple file like this:
#include <boost/smart_ptr.hpp> int main() { boost::shared_ptr<int> p(new int);
return 0; }
I compiled it, and got the following output: gcc -c -Wall -W -Werror -Wundef -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings -Wconversion -idirafter c: /programming/lib/kakefisk -Ic:/programming/boost_1_30_0 -O3 -fomit-frame-pointer -ffast-math btest.cpp -o btest.o In file included from c:/programming/boost_1_30_0/boost/scoped_ptr. hpp:16, from c:/programming/boost_1_30_0/boost/smart_ptr.hpp: 17, from btest.cpp:1: c:/programming/boost_1_30_0/boost/checked_delete.hpp:4:5: "_MSC_VER" is not defined
The problem is caused by -Wundef generating a warning for the #if _MSC_VER >= 1020 test, and by -Werror turning that warning into an error. I'll fix the CVS version of smart_ptr to compile cleanly under -Wundef; in the meantime you could either drop -Wundef or change the above lines to #if defined(_MSC_VER) && (_MSC_VER >= 1020)
--- In Boost-Users@yahoogroups.com, Gennaro Prota <gennaro_prota@y...> wrote:
On Thu, 12 Jun 2003 20:02:19 +0300, "Peter Dimov" <pdimov@m...> wrote:
I'll fix the CVS version of smart_ptr to compile cleanly under -Wundef;
Hmm... our BOOST_WORKAROUND has the same "problem" and we can't write it in terms of the defined operator.
Genny.
I just noticed this myself. Boost is forcing me to remove -Wundef from my makefile. It's not the most important compiler warning, but I would like to have it enabled nevertheless.
participants (3)
-
Gennaro Prota
-
omnizionic
-
Peter Dimov