错误:命名构造函数,而不是类型.使用g++4.6.1编译时
Error : names the constructor, not the type. while compiling with g++4.6.1
我在aix6.1上用g++4.6.1编译代码,得到这个错误:-
ViaChecks.h:14:3: error: 'BuPolygonEX<AllPass<CornerT<NetAndVal<ZVal3> > > >::IOPS::Base {aka BuPolygonCore<bu_polygon_clean_func, no_derivatives, AllPass<CornerT<NetAndVal<ZVal3> > > >::IOPS}::IOPS' names the constructor, not the type
结构定义为:
struct ViaSquareCheck : BuPolygonEX<AllPass<CornerT<NetAndVal<ZVal3> > > > {
typedef BuPolygonEX<AllPass<CornerT<NetAndVal<ZVal3> > > > Base;
DEFINE_ENGINE_PROPERTIES_INHERIT(Base::IOPS, void update() { Base::update(); i().xregion_1nm_oversize(x0nm); o().xregion_1nm_oversize(x0nm); o().derivatives(x_dom); o().bu_polygonized(yes); }); // via_square_dim property is added inside
membert(int, amount, -1, ViaSquareCheck);
ViaSquareCheck();
ViaSquareCheck* output(DFC* dfc) { return set_output(0,dfc); } // single output returns good vias
ViaSquareCheck* set_output(int k, DFC* dfc);
void option(const string& pname, const string& pval); // some options change engine properties
private:
BadViaMultiplexer<C>* mux;
GIM2a<APC> bad_via_gim;
GIM2a<APC> good_via_gim;
member(bool, linked, false);
member(bool, ok_45, false);
void link();
member(ViaSquareCheckNetProcess*, np,NULL);
};
DEFINE_ENGINE_PROPERTIES_INHERIT的定义:-
#define DEFINE_ENGINE_PROPERTIES_INHERIT(SSSS, extras...)
struct IOPS : SSSS {
EnginePropertiesVector& i() { return SSSS::i(); };
EnginePropertiesVector& o() { return SSSS::o(); };
EngineProperties& i(int n) { return SSSS::i(n); };
EngineProperties& o(int n) { return SSSS::o(n); };
typedef SSSS Base;
extras; } ep_;
谢谢。
如果使用名称
,则给出此诊断。myclass::myclass
此名称不表示类myclass
,而是表示它的构造函数
这是一个像Base::IOPS,
这样的限定名称,我们需要在此之前有一个typename
。您需要传递一个类型而不是限定名Base::IOPS
,因此我定义了一个类型
typedef Base::IOPS MYIOP
,然后传递该类型,因此错误"this is not a type"就消失了。
你应该用类似
的东西预处理你的源代码g++ -C -E yoursource.cc | grep -v '^#' > yoursource.ii
(grep -v
删除行编号)
然后用
编译预处理后的表单g++ -Wall -c yoursource.ii
然后查看yoursource.ii
你也可以问gcc-help@gcc.gnu.org
。
但是正如其他人指出的,你的代码不是很漂亮…
当你说:
DEFINE_ENGINE_PROPERTIES_INHERIT(Base::IOPS, ...
你应该写:
DEFINE_ENGINE_PROPERTIES_INHERIT(Base, ...
即没有::IOPS
。
相关文章:
- 如何创建一个CMake变量,除非显式重写,否则使用默认值
- C++:TypeDef使用元组
- 使用std::multimap迭代器创建std::list
- 从不同线程使用int64的不同字节安全吗
- 比较并显示使用最小值(a,b)和最大值(a、b)升序排列的4个数字
- 为什么在全局范围内使用"extern int a"似乎不行?
- 在C#中处理C++指针而不使用unsafe的最佳方法
- 使用C++库在Android项目中修改gradle中的cmake参数,用于插入指令的测试
- 如何使用Google Mock来模拟gettimeofday()
- 如何使用默认参数等选择模板专业化
- 为什么使用 "this" 指针调用派生成员函数?
- 使用新行和不使用新行读取文件
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 如何确定我已使用非编码文件到达 EOF?
- 如何在cuSparse中使用cusparseXcoo2csr从coo转换为csc
- 使用CMake创建QML插件
- 使用strcpy将char数组的元素复制到另一个数组
- 在c++中使用nlohmann从类到json的转换
- 使用指针从C++中的数组中获取最大值
- 使用不带参数的函数访问结构元素