Все, я использую Cygwin gcc 4.8.1 с Netbeans 7.3.1 на Win 7 pro x64. Я пытался собрать проект GAlib, но столкнулся с проблемами создания экземпляров шаблона:
g++ -g -Wall -I.. -c ex17.C
../ga/GA2DArrayGenome.C: In instantiation of ‘GA2DArrayAlleleGenome::GA2DArrayAlleleGenome(unsigned int, unsigned int, const GAAlleleSet&, GAGenome::Evaluator, void*) [with T = int; GAGenome::Evaluator = float (*)(GAGenome&)]’:
In file included from ../ga/GA2DArrayGenome.h:150:0,
from ../ga/ga.h:168,
from ex17.C:13:
ex17.C:45:63: required from here
../ga/GA2DArrayGenome.C:272:75: error: ‘initializer’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
initializer(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
^
../ga/GA2DArrayGenome.C:272:75: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup
../ga/GA2DArrayGenome.C:272:75: note: use ‘this->initializer’ instead
../ga/GA2DArrayGenome.C:273:67: error: ‘mutator’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
mutator(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_MUTATOR);
^
../ga/GA2DArrayGenome.C:273:67: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup
../ga/GA2DArrayGenome.C:273:67: note: use ‘this->mutator’ instead
../ga/GA2DArrayGenome.C:274:73: error: ‘comparator’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
comparator(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
^
../ga/GA2DArrayGenome.C:274:73: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup
../ga/GA2DArrayGenome.C:274:73: note: use ‘this->comparator’ instead
../ga/GA2DArrayGenome.C:275:71: error: ‘crossover’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
crossover(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
^
../ga/GA2DArrayGenome.C:275:71: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup
../ga/GA2DArrayGenome.C:275:71: note: use ‘this->crossover’ instead
../ga/GA2DArrayGenome.C: In instantiation of ‘GA2DArrayAlleleGenome::GA2DArrayAlleleGenome(unsigned int, unsigned int, const GAAlleleSetArray&, GAGenome::Evaluator, void*) [with T = int; GAGenome::Evaluator = float (*)(GAGenome&)]’:
ex17.C:138:28: required from here
../ga/GA2DArrayGenome.C:289:75: error: ‘initializer’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
initializer(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_INITIALIZER);
^
../ga/GA2DArrayGenome.C:289:75: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup
../ga/GA2DArrayGenome.C:289:75: note: use ‘this->initializer’ instead
../ga/GA2DArrayGenome.C:290:67: error: ‘mutator’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
mutator(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_MUTATOR);
^
../ga/GA2DArrayGenome.C:290:67: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup
../ga/GA2DArrayGenome.C:290:67: note: use ‘this->mutator’ instead
../ga/GA2DArrayGenome.C:291:73: error: ‘comparator’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
comparator(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_COMPARATOR);
^
../ga/GA2DArrayGenome.C:291:73: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup
../ga/GA2DArrayGenome.C:291:73: note: use ‘this->comparator’ instead
../ga/GA2DArrayGenome.C:292:71: error: ‘crossover’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
crossover(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_CROSSOVER);
^
../ga/GA2DArrayGenome.C:292:71: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup
../ga/GA2DArrayGenome.C:292:71: note: use ‘this->crossover’ instead
makefile:27: recipe for target `ex17.o' failed
make[1]: *** [ex17.o] Error 1
make[1]: Leaving directory `/cygdrive/c/Users/Daiyue/Documents/NetBeansProjects/galib247/examples'
Makefile:19: recipe for target `ex' failed
make: *** [ex] Error 2
Я также определил NO_AUTO_INST в gaconfig.h, но ошибки не исчезли. Так как же решить эту проблему?
Все, я использую Cygwin gcc 4.8.1 с Netbeans 7.3.1 на Win 7 pro x64. Я пытался собрать проект GAlib, но столкнулся с проблемами создания экземпляров шаблона: [code]g++ -g -Wall -I.. -c ex17.C ../ga/GA2DArrayGenome.C: In instantiation of ‘GA2DArrayAlleleGenome::GA2DArrayAlleleGenome(unsigned int, unsigned int, const GAAlleleSet&, GAGenome::Evaluator, void*) [with T = int; GAGenome::Evaluator = float (*)(GAGenome&)]’: In file included from ../ga/GA2DArrayGenome.h:150:0, from ../ga/ga.h:168, from ex17.C:13: ex17.C:45:63: required from here ../ga/GA2DArrayGenome.C:272:75: error: ‘initializer’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] initializer(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_INITIALIZER); ^ ../ga/GA2DArrayGenome.C:272:75: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup ../ga/GA2DArrayGenome.C:272:75: note: use ‘this->initializer’ instead ../ga/GA2DArrayGenome.C:273:67: error: ‘mutator’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] mutator(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_MUTATOR); ^ ../ga/GA2DArrayGenome.C:273:67: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup ../ga/GA2DArrayGenome.C:273:67: note: use ‘this->mutator’ instead ../ga/GA2DArrayGenome.C:274:73: error: ‘comparator’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] comparator(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_COMPARATOR); ^ ../ga/GA2DArrayGenome.C:274:73: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup ../ga/GA2DArrayGenome.C:274:73: note: use ‘this->comparator’ instead ../ga/GA2DArrayGenome.C:275:71: error: ‘crossover’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] crossover(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_CROSSOVER); ^ ../ga/GA2DArrayGenome.C:275:71: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup ../ga/GA2DArrayGenome.C:275:71: note: use ‘this->crossover’ instead ../ga/GA2DArrayGenome.C: In instantiation of ‘GA2DArrayAlleleGenome::GA2DArrayAlleleGenome(unsigned int, unsigned int, const GAAlleleSetArray&, GAGenome::Evaluator, void*) [with T = int; GAGenome::Evaluator = float (*)(GAGenome&)]’: ex17.C:138:28: required from here ../ga/GA2DArrayGenome.C:289:75: error: ‘initializer’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] initializer(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_INITIALIZER); ^ ../ga/GA2DArrayGenome.C:289:75: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup ../ga/GA2DArrayGenome.C:289:75: note: use ‘this->initializer’ instead ../ga/GA2DArrayGenome.C:290:67: error: ‘mutator’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] mutator(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_MUTATOR); ^ ../ga/GA2DArrayGenome.C:290:67: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup ../ga/GA2DArrayGenome.C:290:67: note: use ‘this->mutator’ instead ../ga/GA2DArrayGenome.C:291:73: error: ‘comparator’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] comparator(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_COMPARATOR); ^ ../ga/GA2DArrayGenome.C:291:73: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup ../ga/GA2DArrayGenome.C:291:73: note: use ‘this->comparator’ instead ../ga/GA2DArrayGenome.C:292:71: error: ‘crossover’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] crossover(GA2DArrayAlleleGenome::DEFAULT_2DARRAY_ALLELE_CROSSOVER); ^ ../ga/GA2DArrayGenome.C:292:71: note: declarations in dependent base ‘GAGenome’ are not found by unqualified lookup ../ga/GA2DArrayGenome.C:292:71: note: use ‘this->crossover’ instead makefile:27: recipe for target `ex17.o' failed make[1]: *** [ex17.o] Error 1 make[1]: Leaving directory `/cygdrive/c/Users/Daiyue/Documents/NetBeansProjects/galib247/examples' Makefile:19: recipe for target `ex' failed make: *** [ex] Error 2 [/code] Я также определил NO_AUTO_INST в gaconfig.h, но ошибки не исчезли. Так как же решить эту проблему?
В чем разница в приведенном ниже коде между созданием экземпляра круга как типа Shape и прямоугольника как типа Rectangle?
Shape — это базовый класс, Circle и Rectangle являются производными от Shape. Каждый экземпляр комментируется тем, что...
В чем разница в приведенном ниже коде между созданием экземпляра круга как типа Shape и прямоугольника как типа Rectangle?
Shape — это базовый класс, Circle и Rectangle являются производными от Shape. Каждый экземпляр комментируется тем, что...
В чем разница в приведенном ниже коде между созданием экземпляра круга как типа Shape и прямоугольника как типа Rectangle?
Shape — это базовый класс, Circle и Rectangle являются производными от Shape. Каждый экземпляр комментируется тем, что...
В чем разница в приведенном ниже коде между созданием экземпляра круга как типа Shape и прямоугольника как типа Rectangle?
Shape — это базовый класс, Circle и Rectangle являются производными от Shape. Каждый экземпляр комментируется тем, что...
В чем разница в приведенном ниже коде между созданием экземпляра круга как типа Shape и прямоугольника как типа Rectangle?
Shape — это базовый класс, Circle и Rectangle являются производными от Shape. Каждый экземпляр комментируется тем, что...