开发者

problem using boost in c++ app

开发者 https://www.devze.com 2023-02-19 05:49 出处:网络
Once I added the following include to my app: #include <boost/regex.hpp> It spits out some errors I have no idea what they are about (newbie to c++):

Once I added the following include to my app:

#include <boost/regex.hpp> 

It spits out some errors I have no idea what they are about (newbie to c++):

In file included from /usr/include/boost/regex/regex_traits.hpp:27,
                 from /usr/include/boost/regex/v4/regex.hpp:39,
                 from /usr/include/boost/regex.hpp:31,
                 from my_app.c:28:
/usr/include/boost/regex/v4/regex_traits.hpp:80:1: error: macro "test" passed 2 arguments, but takes just 1
/usr/include/boost/regex/v4/regex_traits.hpp:80: error: template declaration of âchar (& boost::re_detail::test)[2]â
/usr/include/boost/regex/v4/regex_traits.hpp:80: error: expected unqualified-id before â...â token
/usr/include/boost/regex/v4/regex_traits.hpp:80: error: expected `)' before â...â token
/usr/include/boost/regex/v4/regex_traits.hpp:80: error: expected `)' before â...â token
/usr/include/boost/regex/v4/regex_traits.hpp:80: error: expected unqualified-id before â(â token
/usr/include/boost/regex/v4/regex_traits.hpp:80: error: âboost::re_detail::has_boost_extensions_tag&l开发者_如何学Pythont;T, fallback_>::valueâ is not a valid template argument for type âboolâ because it is a non-constant expression

I installed boost on centos using:

yum install boost boost-devel boost-doc

I compile the app using:

g++ -o my_app my_app.c $(mysql_config --libs --cflags

Headers:

#include <stdio.h>
#include <my_global.h>
#include <mysql.h>
#include <string.h>
#include <stdlib.h>

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <dirent.h>
#include <regex.h>
#include <iterator>
#include <boost/regex.hpp> 

#include <sstream>
#include <fstream>
#include <iostream>
#include <vector>

Can someone help me out?


Is this accidential or are you compiling C code with a C++ compiler?

Try to rename your file to my_app.cc or so to see if that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消