I get this error when using stl_vector.h . I use Linux using g ++ to compile.
{ if (max_size() - size() < __n) __throw_length_error(__N(__s)); const size_type __len = size() + std::max(size(), __n); //THE ERROR IS ON THIS LINE! return (__len < size() || __len > max_size()) ? max_size() : __len; }
usr / include / C ++ / 4.5 / bits / stl_vector.h: 1143: 40: error: expected unqualified-id before token '('
I'm not sure why I get this error, I searched a lot and found some βsimilarβ problems, but I can not solve my problem.
EDIT: here's the error log:
In file included from /usr/include/c++/4.5/vector:65:0, from ../../RL_Toolbox/include/caction.h:34, from ../../RL_Toolbox/include/cagent.h:35, from shortestpathQLearning.cpp:42: /usr/include/c++/4.5/bits/stl_vector.h:1143:40: error: expected unqualified-id before '(' token
In the previous error log, you can see that the "vector" is called by the header "caction.h" as follows:
//THESE ARE THE INCLUDES IN "caction.h" #ifndef CACTION_H #define CACTION_H #include <stdio.h> #include <vector> //HERE IT CALLS <vector> #include <list> #include <map> #include "cbaseobjects.h"
then Vector calls the / stl _vector.h bits as follows:
#ifndef _GLIBCXX_VECTOR #define _GLIBCXX_VECTOR 1 #pragma GCC system_header #include <bits/stl_algobase.h> #include <bits/allocator.h> #include <bits/stl_construct.h> #include <bits/stl_uninitialized.h> #include <bits/stl_vector.h>//HERE IT CALLS stl_vector.h #include <bits/stl_bvector.h> //Im actually getting the exact same error from stl_vector.h on this header
only the last 2 headers from the vector (stl_vector and stl_bvector) give me the same error, the rest are fine. Any ideas?
Thanks in advance for your help.
c ++ g ++
user977480
source share