用g++3.3编译成功,为何用g++4.3.2编译不成功?

C、C++和Java语言
回复
deepresearch
帖子: 5
注册时间: 2008-11-10 17:04
送出感谢: 0
接收感谢: 0

用g++3.3编译成功,为何用g++4.3.2编译不成功?

#1

帖子 deepresearch » 2008-11-10 17:15

以前我用g++-3.3,编译通过,程序运行良好。后来安装了ubuntu后,g++升级成了g++-4.3.2.连编译都不通过了。
以下是错误提示,烦请高人指点,有什么解决方法。是不是要重新安装低版本的g++-3.3?
In file included from funktion.h:14,
from funktion.cc:1:
ga.h: In member function ‘bool Special<T>::SetInPara(unsigned int, unsigned int)’:
ga.h:170: error: there are no arguments to ‘memset’ that depend on a template parameter, so a declaration of ‘memset’ must be available
ga.h:170: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
ga.h: In member function ‘void BinGA<T, V>::DuplicateBest()’:
ga.h:300: error: ‘MidStruct’ was not declared in this scope
ga.h:301: error: ‘BestPopulation’ was not declared in this scope
ga.h:302: error: ‘InParaNo’ was not declared in this scope
ga.h: In member function ‘void BinGA<T, V>::IniCHOAS()’:
ga.h:353: error: ‘InParaNo’ was not declared in this scope
ga.h:355: error: ‘ChoasChannel’ was not declared in this scope
ga.h:365: error: ‘InParaNo’ was not declared in this scope
ga.h:366: error: ‘ChoasChannel’ was not declared in this scope
ga.h: In member function ‘T BinGA<T, V>::CHOAS(int)’:
ga.h:372: error: ‘InParaNo’ was not declared in this scope
ga.h:373: error: ‘ChoasChannel’ was not declared in this scope
ga.h: In member function ‘T BinGA<T, V>::CHOAS()’:
ga.h:377: error: ‘ChoasChannel’ was not declared in this scope
ga.h:377: error: ‘InParaNo’ was not declared in this scope
ga.h: In member function ‘bool BinGA<T, V>::Coding(T, T, V, int*)’:
ga.h:418: error: ‘MidStruct’ was not declared in this scope
ga.h:418: error: ‘Index4CodingProc’ was not declared in this scope
ga.h:425: error: ‘inStruct’ was not declared in this scope
ga.h: In member function ‘bool BinGA<T, V>::Coding(T*, T*, T*, unsigned int, int*)’:
ga.h:443: error: ‘InParaNo’ was not declared in this scope
ga.h: In member function ‘void BinGA<T, V>::Random()’:
ga.h:454: error: ‘SpecialNo’ was not declared in this scope
ga.h:455: error: ‘InParaNo’ was not declared in this scope
ga.h:456: error: ‘MidStruct’ was not declared in this scope
ga.h:479: error: ‘SpecialNo’ was not declared in this scope
ga.h:480: error: ‘InParaNo’ was not declared in this scope
ga.h:485: error: ‘MidStruct’ was not declared in this scope
ga.h:491: error: ‘Index4CodingProc’ was not declared in this scope
ga.h: In member function ‘void BinGA<T, V>::Mutant()’:
ga.h:499: error: ‘InParaNo’ was not declared in this scope
ga.h:503: error: ‘MidStruct’ was not declared in this scope
ga.h:516: error: ‘SpecialNo’ was not declared in this scope
ga.h:517: error: ‘ShareMemPool’ was not declared in this scope
ga.h:518: error: ‘InParaNo’ was not declared in this scope
ga.h:519: error: ‘MidStruct’ was not declared in this scope
ga.h:558: error: ‘SpecialNo’ was not declared in this scope
ga.h:564: error: ‘InParaNo’ was not declared in this scope
ga.h:568: error: ‘MidStruct’ was not declared in this scope
ga.h: In member function ‘bool BinGA<T, V>::GetBestResult(T*, int*)’:
ga.h:580: error: ‘SpecialNo’ was not declared in this scope
ga.h:581: error: ‘outResult’ was not declared in this scope
ga.h:581: error: ‘InParaNo’ was not declared in this scope
ga.h:586: error: ‘InParaNo’ was not declared in this scope
ga.h:587: error: ‘outResult’ was not declared in this scope
ga.h: In member function ‘bool BinGA<T, V>::GetResult(T*, int*)’:
ga.h:595: error: ‘SpecialNo’ was not declared in this scope
ga.h:595: error: ‘InParaNo’ was not declared in this scope
ga.h:596: error: ‘outResult’ was not declared in this scope
ga.h: In member function ‘T* BinGA<T, V>::GetResult()’:
ga.h:600: error: ‘outResult’ was not declared in this scope
ga.h: In member function ‘void BinGA<T, V>::ReturnInPara(T*)’:
ga.h:604: error: ‘FittingArray’ was not declared in this scope
ga.h:604: error: ‘SpecialNo’ was not declared in this scope
ga.h:606: error: ‘MidStruct’ was not declared in this scope
ga.h:606: error: ‘inStruct’ was not declared in this scope
ga.h:606: error: ‘InParaNo’ was not declared in this scope
ga.h: In member function ‘void BinGA<T, V>::SORT(T*)’:
ga.h:664: error: ‘SpecialNo’ was not declared in this scope
ga.h:665: error: ‘SortStruct’ was not declared in this scope
ga.h:668: error: ‘SortStruct’ was not declared in this scope
ga.h:668: error: ‘SpecialNo’ was not declared in this scope
ga.h: In member function ‘bool BinGA<T, V>::Crossover(int*)’:
ga.h:676: error: ‘FittingArray’ was not declared in this scope
ga.h:676: error: ‘SpecialNo’ was not declared in this scope
ga.h:684: error: ‘MidStruct’ was not declared in this scope
ga.h:684: error: ‘inStruct’ was not declared in this scope
ga.h:684: error: ‘InParaNo’ was not declared in this scope
ga.h:685: error: ‘outResult’ was not declared in this scope
ga.h:706: error: ‘outResult’ was not declared in this scope
ga.h:721: error: ‘ShareMemPool’ was not declared in this scope
ga.h:726: error: ‘SortStruct’ was not declared in this scope
ga.h:729: error: ‘InParaNo’ was not declared in this scope
ga.h:730: error: ‘BestPopulation’ was not declared in this scope
ga.h:730: error: ‘MidStruct’ was not declared in this scope
ga.h:739: error: ‘ShareMemPool’ was not declared in this scope
ga.h:744: error: ‘InParaNo’ was not declared in this scope
ga.h:745: error: ‘MidStruct’ was not declared in this scope
ga.h:773: error: ‘ShareMemPool’ was not declared in this scope
ga.h:778: error: ‘InParaNo’ was not declared in this scope
ga.h:779: error: ‘MidStruct’ was not declared in this scope
ga.h:804: error: ‘ShareMemPool’ was not declared in this scope
ga.h:809: error: ‘InParaNo’ was not declared in this scope
ga.h:810: error: ‘MidStruct’ was not declared in this scope
ga.h:827: error: ‘InParaNo’ was not declared in this scope
ga.h:828: error: ‘MidStruct’ was not declared in this scope
ga.h:828: error: ‘BestPopulation’ was not declared in this scope
ga.h: In member function ‘bool BinGA<T, V>::Selection(T*, unsigned int*, unsigned int, int)’:
ga.h:983: error: ‘SortStruct’ was not declared in this scope
ga.h:986: error: ‘SortStruct’ was not declared in this scope
ga.h:994: error: ‘SortStruct’ was not declared in this scope
ga.h:997: error: ‘SortStruct’ was not declared in this scope
ga.h: In member function ‘void BinGA<T, V>::FillTracerBuf(int*)’:
ga.h:1014: error: ‘FittingArray’ was not declared in this scope
ga.h:1014: error: ‘SpecialNo’ was not declared in this scope
ga.h:1016: error: ‘MidStruct’ was not declared in this scope
ga.h:1016: error: ‘inStruct’ was not declared in this scope
ga.h:1016: error: ‘InParaNo’ was not declared in this scope
make: *** [funktion.o] Error 1
头像
ChenFengyuan
帖子: 770
注册时间: 2008-03-23 0:39
送出感谢: 0
接收感谢: 4 次

Re: 用g++3.3编译成功,为何用g++4.3.2编译不成功?

#2

帖子 ChenFengyuan » 2008-11-10 19:38

看下这个,虽然错误和你的不一样,不过也是编译器的兼容问题

http://bones7456.blog.ubuntu.org.cn/200 ... erence_to/
deepresearch
帖子: 5
注册时间: 2008-11-10 17:04
送出感谢: 0
接收感谢: 0

Re: 用g++3.3编译成功,为何用g++4.3.2编译不成功?

#3

帖子 deepresearch » 2008-11-10 20:51

在ubuntu上面下载了: Package: g++-3.3 (1:3.3.6-15ubuntu6) [universe]
和依赖包:
gcc-3.3 (= 1:3.3.6-15ubuntu6)
GNU C 語言編譯器

dep: gcc-3.3-base (= 1:3.3.6-15ubuntu6)
GNU 編譯器組合(基本套件)

dep: libc6 (>= 2.3)
GNU C 函式庫:共用函式庫
also a virtual package provided by libc6-udeb

dep: libstdc++5-3.3-dev (= 1:3.3.6-15ubuntu6)
The GNU Standard C++ Library v3 (development files)

sug: gcc-3.3-doc (>= 1:3.3.6-15ubuntu6)
Documentation for the GNU compilers (gcc, gobjc, g++)

重新安装了g++-3.3,问题解决了。

谢谢楼上的回答。
回复

回到 “C/C++/Java”