使用stl_vector.h时出现此错误.我在
Linux上用g来编译.
{
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
我不知道为什么我会收到这个错误,我经常搜索并找到一些“相似”的问题,但我无法解决这个问题.
编辑:所以这是错误日志:
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
您可以在上一个错误日志中看到“vector”被标题“caction.h”调用,如下所示:
//THESE ARE THE INCLUDES IN "caction.h"
#ifndef CACTION_H
#define CACTION_H
#include
#include //HERE IT CALLS
#include
#include
#include "cbaseobjects.h"
然后Vector调用bits / stl_vector.h,如下所示:
#ifndef _GLIBCXX_VECTOR
#define _GLIBCXX_VECTOR 1
#pragma GCC system_header
#include
#include
#include
#include
#include //HERE IT CALLS stl_vector.h
#include //Im actually getting the exact same error from stl_vector.h on this header
只有来自vector的最后两个标题(stl_vector和stl_bvector)给出了完全相同的错误,其余的都没问题.有任何想法吗?
在此先感谢您的帮助.