|
Boost Users : |
Subject: Re: [Boost-users] Compile errors including boost/regex.hpp
From: Anthony Foiani (tkil_at_[hidden])
Date: 2013-05-22 16:10:49
"Jordan H." <jordannh_at_[hidden]> writes:
> When I try to compile a file that includes <boost/regex.hpp> I get the
> following error:
>
> # /home/me/Projects/myproject> make
> # /usr/bin/make all-am
> # make[1]: Entering directory `/home/me/Projects/myproject'
> # compiling main.cpp (g++)
> # In file included from
> /usr/local/include/boost/regex/regex_traits.hpp:27:0,
> # from /usr/local/include/boost/regex/v4/regex.hpp:39,
> # from /usr/local/include/boost/regex.hpp:31,
> # [ ... more traceback ... ]
> #
> # /usr/local/include/boost/regex/v4/regex_traits.hpp:87:1: error: macro
> "test" passed 2 arguments, but
> # takes just 1
That's kind of insane. On my copy of 1_53_0, that section of
boost/regex/v4/regex_traits.hpp are:
85 namespace re_detail{
86 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, < 60000)
87 BOOST_MPL_HAS_XXX_TRAIT_DEF(boost_extensions_tag)
88 #else
89 template<class T>
90 struct has_boost_extensions_tag
91 {
92 BOOST_STATIC_CONSTANT(bool, value = false);
93 };
94 #endif
> This is how I'm compiling:
>
> # g++ -DHAVE_CONFIG_H -I. `mysql_config --include` `mysql_config
> --cflags` -std=c++0x -g -O2 -MT
> # myproject-main.o -MD -MP -MF .deps/myproject-main.Tpo -c -o
> myproject-main.o `test -f 'src/main.cpp'
> # || echo './'`src/main.cpp
That's hard to read. Is this the same command?
g++ -DHAVE_CONFIG_H -I. \
`mysql_config --include` `mysql_config --cflags` \
-std=c++0x -g -O2 \
-MT myproject-main.o -MD -MP -MF .deps/myproject-main.Tpo \
-c -o myproject-main.o \
`test -f 'src/main.cpp' || echo './'`src/main.cpp
If so, you should look at the preprocessed output (although you'll
likely still get warnings). You can also get the list of where all
the macros are defined. Something like this:
g++ -DHAVE_CONFIG_H -I. \
`mysql_config --include` `mysql_config --cflags` \
-std=c++0x -g -O2 \
-MT myproject-main.o -MD -MP -MF .deps/myproject-main.Tpo \
-dD -E -o myproject-main.i \
`test -f 'src/main.cpp' || echo './'`src/main.cpp
(Note changes: "-c" to "-dD -E", and ".o" to ".i" output).
Now you can look through "myproject-main.i" and see if some header is
defining "test" or not.
If that didn't work, a few more questions:
1. What OS and compiler, and what versions of each?
2. Is this a proper install of boost (through bootstrap etc), or did
you just copy the header files in?
3. Can you get a small, self-contained example to compile
successfully? (e.g., no libtool noise)
Good luck!
Best regards,
Anthony Foiani
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net