проблема с использованием Boost в приложении C ++ - PullRequest
0 голосов
/ 24 марта 2011

Как только я добавил следующее, включите в мое приложение:

#include <boost/regex.hpp> 

Это выдает некоторые ошибки, я понятия не имею, о чем они (новичок в 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<T, fallback_>::valueâ is not a valid template argument for type âboolâ because it is a non-constant expression

Я установил надстройку на Centos, используя:

yum install boost boost-devel boost-doc

Я компилирую приложение, используя:

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

Заголовки:

#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>

Может ли кто-нибудь мне помочь?

1 Ответ

0 голосов
/ 24 марта 2011

Это случайно или вы компилируете код C с помощью компилятора C ++?

Попробуйте переименовать файл в my_app.cc или около того, чтобы посмотреть, поможет ли это.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...