Amule编译问题
编译aMule-2.3.1源码时竟然遇到了错误:
ObservableQueue.h: In instantiation of ‘void CObservableQueue<ValueType>::ObserverRemoved(CObservableQueue<ValueType>::ObserverType*) [with ValueType = CPartFile*; CObservableQueue<ValueType>::ObserverType = CObserver<CQueueEvent<CPartFile*> >]’:
DownloadQueue.cpp:1665:1: required from here
ObservableQueue.h:341:2: error: ‘NotifyObservers’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation
找了3个小时才找到原因,在这里:
http://gcc.gnu.org/gcc-4.7/porting_to.html
Name lookup changesThe C++ compiler no longer performs some extra unqualified lookups it had performed in the past, namely dependent base class scope lookups and unqualified template function lookups.
C++ programs that depended on the compiler's previous behavior may no longer compile. For example, code such as
intf(int i){ return i; }template<typename T>int t(T i){ return f(i); }intmain(){ return t(1);}
This can be temporarily worked around by using -fpermissive.
总之,是gcc4.7带来的问题,如下配置即可解决:
./configure CPPFLAGS=-fpermissive