У меня есть класс форм, он работает по принципу, что форма состоит из точек (x и y координат). Но перегрузка операторов ввода и вывода я столкнулся с проблемой, которая может служить ошибкой.In file included from main.cpp:1:
./header/figure.h:17:82: warning: friend declaration ‘std::ostream& operator(std::istream & stream, Figure & fig);
| ^
/usr/bin/ld: /tmp/ccVeFfI2.o: в функции «main»:
main.cpp:(.text+0xdb): неопределённая ссылка на «operator(std::istream&, Figure&)»
collect2: error: ld returned 1 exit status
< /code>
figure.h
#pragma once
#include
#include "./dynamicArray.h"
template
class Figure
{
public:
Figure();
Figure(const DArray & points);
Figure(const std::initializer_list & coord);
~Figure() noexcept;
friend std::ostream & operator(std::istream & stream, Figure & fig);
protected:
DArray _points;
std::string _name = "unnamed";
};
#include "../src/figure.cpp"
< /code>
figure.cpp
#include "../header/figure.h"
template
Figure::Figure() :
_points() {}
template
Figure::Figure(const DArray & points) :
_points(points) {}
template
Figure::Figure(const std::initializer_list & coord) :
_points(coord) {}
template
Figure::~Figure() noexcept
{
}
template
std::ostream & operator
Подробнее здесь: https://stackoverflow.com/questions/773 ... -templates