g++ error: expected nested-name-specifier before 'XXX'

 1 template <typename addrT=int,typename valuT=int,typename stream_addrT=bm_addr,typename stream_sizeT=int64>
 2 class  stream_chip : public chip<addrT,valuT>{
 3 public:
 4     typedef  typename stream_addrT stream_addr_type;
 5     typedef  typename stream_sizeT stream_size_type;
 6
 7     stream_chip (bus_type * const owner, addr_type addr):chip<addrT,valuT>(owner,addr)
 8     {}
 9 public:
10     virtual stream_size_type write_mem(stream_addr_type dest_addr, void* pValue ,stream_size_type size)=0;  //write board memory
11     virtual stream_size_type read_mem(void* pValue,stream_size_type size ,stream_addr_type src_addr)=0;        //read bpard memory
12
13 };
明明全部代码都在VS编译下好好的

把以上public的typename删除就行了。错误就不报了。唉,移植就是ISO标准问题多。各平台的扩展实现也乱七八糟。

references:http://bbs.csdn.net/topics/370075224http://stackoverflow.com/questions/5249835/expected-nested-name-specifier-before-const-error-with-typename-const-in-g

g++ error: expected nested-name-specifier before 'XXX'

时间: 2024-08-07 03:12:26

g++ error: expected nested-name-specifier before 'XXX'的相关文章

error: expected declaration specifiers or &#39;...&#39; before xxx(xxx是函数形参)

在使用带参有返回值的函数指针做参数时,编译出现下面情况 -------- error: expected declaration specifiers or '...' before 'FunType' 情形描述: a.h: typedef void (*FunType)(); void callFun(FunType p); a.c : #include "a.h" FunType myfuntype=NULL; void callFun(FunType p) { myfuntype

g++ error: expected ‘)’ before ‘*’ token

原本*号前面的类型是我用typedef自定义的类型的,MyType* const p: 发生这样的错误是,编译器根本不知道MyType是什么东西,这是我在C++多重继承中遇到的.MyType是我在基类中public中定义的类型,结果在它的孙子类发生出这样的情况,不识别这个新类型.但是儿子类中也有MyType类型,却没有报错. 在孙子类中根据基类重新typedef下MyType就好了,编译器就能识别次类型了. reference: http://stackoverflow.com/question

Error: Expected resource of type xxx [ResourceType]

运行环境:Android Studio 1.4 gradle版本:2.10 工程编译没有问题,并且能在模拟器和真机上正常运行,但是当打包成Apk的时候,出现了 Error:Error: Expected resource of type color [ResourceType]  这个错误,导致打包不成功. 以下是出错地方的代码: private static RadioButton createGroupTabItem(Context context, MemberType data) { R

Log4j2报错ERROR StatusLogger Unrecognized format specifier

问题 使用maven-shade-plugin或者maven-assembly-plugin插件把项目打成一个可执行JAR包时,如果你引入了log4j2会出现如下问题: ERROR StatusLogger Unrecognized format specifier [d] ERROR StatusLogger Unrecognized conversion specifier [d] starting at position 16 in conversion pattern. ERROR St

Error: expected expression, got &#39;}&#39;

1.错误描述 Error: expected expression, got '}' .globalEval/<@http://localhost:8080/Sys/resource/global/plugins/jquery.min.js:2:2613 [email protected]://localhost:8080/Sys/resource/global/plugins/jquery.min.js:2:2587 [email protected]://localhost:8080/Sys

Cocos2d-x 3.0 编译出错 解决 error: expected &amp;#39;;&amp;#39; at end of member declaration

近期把项目移植到cocos2d-x 3.0,在整Android编译环境的时候,出现一大堆的编译出错,都是类似"error: expected ';' at end of member declaration"之类的,看了一些编译错误,都是cocos2d-x库里面的代码出错. 经过分析,怀疑可能是编译环境的问题,由于cocos2d-x使用了非常多C++11的新特性,这有可能导致老的编译器出错,看了一下NDK以下的文件以及toolchains里面的内容,windows编译器默认使用4.6,

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int(转)

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 错误类型: 缺失类型表述 错误原因: 函数前未写函数的返回类型,由此导致了这个错误 解决方法: 以后写函数,不管是声明还是定义,都要加上返回类型,尤其是返回类型是VOID时,更要加上 不要省略 error C4430: missing type specifier - int assumed. Note: C++ do

could not build module &#39;XXXXXXXX&#39;或者error: expected identifier or &#39;(&#39; 。一堆奇怪的错误————错误根源

一堆奇怪的错误:1??could not build module 'XXXXXXXX' 2??error: expected identifier or '(' 3??EDIT Setting Precompile prefix header = No results in a bunch of syntax errors instead, in stuff like NSObject.h (and other 4??Foundation framework header) 5??EDIT U

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

最近发现一个奇怪的错误,错误提示如下: error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 出现该段错误的源码(某公司校招技术笔试题)如下: #include<iostream> using namespace std; main() { long x=65530; long countx=0; while(x) { countx++; x=x&(x-1);