Код: Выделить всё
#ifndef banana_h
#define banana_h
#include
std::string foo(std::string a);
std::string bar(std::string b);
#endif
Код: Выделить всё
#include "banana.h"
#include "../grape.h"
#include "../apple.h"
using std::string;
using std::vector;
string foo(string a)
{
// Lots of stuff in here...
}
string bar(string b)
{
// Lots of stuff in here...
}
Код: Выделить всё
banana.cpp:(.text+0x2ed): multiple definition of `foo(std::__cxx11::basic_string)'; ./headers/banana.o:banana.cpp:(.text+0x2ed): first defined here
Примечание: я использую make-файл для компиляции всех своих файлов.>
Подробнее здесь: https://stackoverflow.com/questions/798 ... eclaration
Мобильная версия