компилировать проект с помощью команды сделать, но это дает мне эти ошибки:Error «объявляет функцию нешаблонного» в C++
g++ -std=gnu++11 -c Array.cc
In file included from Array.cc:5:0:
Array.h:9:65: warning: friend declaration ‘std::ostream& operator<<(std::ostream&, Array<Items>&)’ declares a non-template function [-Wnon-template-friend]
friend ostream& operator << (ostream& fout, Array<Items>& ary);
^
Array.h:9:65: note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here)
In file included from Array.cc:9:0:
List.h:28:64: warning: friend declaration ‘std::ostream& operator<<(std::ostream&, List<Items>&)’ declares a non-template function [-Wnon-template-friend]
friend ostream& operator << (ostream& fout, List<Items>& lst);
^
Array.cc:112:5: error: specializing member ‘Array<int>::compare’ requires ‘template<>’ syntax
int Array<int>::compare(Array<int>* ar2)
^
Makefile:30: recipe for target 'Array.o' failed
make: *** [Array.o] Error 1
Код в Array.cc İŞ
#include "Array.h"
код в Array.h: 9: 65 is:
class Array{
friend ostream& operator << (ostream& fout, Array<Items>& ary);
private:
int theSz;
int totSz;
Items *theAry;
Можете ли вы объяснить мне эти ошибки? Я использую Ubuntu 15.10. Может быть, это от устаревшей функции в C++, поскольку этот алгоритм был разработан в 2005 году
Пожалуйста ** [править] ** Ваш вопрос с [mcve] или [SSCCE (Short, Self Contained, Correct Example)] (http://sscce.org) – NathanOliver
Что такое строки Array.cc ~ 112? – AndyG
содержит следующее: int Array :: сравнение (Array * ar2) –