我是c ++的新手,我在类中的模板方法方面遇到问题。
[剪切]
---建议后的完整代码---
serializerService.h
// Copyright (c) 2019 All rights reserved.
//
#pragma once
#include <string>
#include "ThorSerialize/SerUtil.h"
#include "ThorSerialize/JsonThor.h"
class SerializerService {
public:
template <class T>
std::string serialize(T &entity){
using ThorsAnvil::Serialize::jsonExport;
using ThorsAnvil::Serialize::PrinterInterface;
std::stringstream stream;
stream << jsonExport(entity, PrinterInterface::OutputType::Stream);
return stream.str();
};
};
serializerService.cpp
//#include "serializerService.h"
和 mainEndpoint.cpp ,其中还包含serializerService.h
#include <user.h>
#include "serializerService.h"
#include "mainEndpoint.h"
void MainEndpoint::doMain(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
User user("admin@admin.com");
user.setUsername("admin");
SerializerService serializer;
std::string data = serializer.serialize(user);
response.cookies()
.add(Pistache::Http::Cookie("lang", "pl_PL"));
response.headers()
.add<Pistache::Http::Header::Server>("Sandbox server v0.1")
.add<Pistache::Http::Header::ContentType>(MIME(Application, Json));
// response.send(Pistache::Http::Code::Ok, "{}");
response.send(Pistache::Http::Code::Ok, data);
}
当我在包含头文件的serializerService.cpp
行中启用时,出现错误:
====================[ Build | sandbox | Debug ]=================================
/home/marcin/Programs/clion-2019.1.3/bin/cmake/linux/bin/cmake --build /home/marcin/CLionProjects/sandbox/cmake-build-debug --target sandbox -- -j 8
[ 76%] Built target pistache
[ 80%] Linking CXX executable sandbox
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::ParserInterface::ignoreValue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:6: multiple definition of `ThorsAnvil::Serialize::ParserInterface::ignoreValue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:6: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::ParserInterface::ignoreTheValue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:47: multiple definition of `ThorsAnvil::Serialize::ParserInterface::ignoreTheValue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:47: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::ParserInterface::ignoreTheMap()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:15: multiple definition of `ThorsAnvil::Serialize::ParserInterface::ignoreTheMap()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:15: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::ParserInterface::ignoreTheArray()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:27: multiple definition of `ThorsAnvil::Serialize::ParserInterface::ignoreTheArray()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:27: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::JsonManualLexer(std::istream&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:10: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::JsonManualLexer(std::istream&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:10: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::JsonManualLexer(std::istream&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:10: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::JsonManualLexer(std::istream&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:10: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::yylex()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:16: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::yylex()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:16: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readTrue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:65: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readTrue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:65: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readFalse()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:70: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readFalse()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:70: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readNull()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:75: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readNull()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:75: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readNumber(int)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:182: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readNumber(int)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:182: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::checkFixed(char const*, unsigned long)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:240: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::checkFixed(char const*, unsigned long)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:240: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::ignoreRawValue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:80: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::ignoreRawValue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:80: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::error()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:251: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::error()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:251: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::getRawString[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:98: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::getRawString[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:98: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::getString[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:147: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::getString[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:147: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::getLastBool() const':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:152: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::getLastBool() const'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:152: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::isLastNull() const':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:164: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::isLastNull() const'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:164: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readDigits(char)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:169: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readDigits(char)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:169: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&, ThorsAnvil::Serialize::ParserInterface::ParserConfig)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:12: multiple definition of `ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&, ThorsAnvil::Serialize::ParserInterface::ParserConfig)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:12: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&, ThorsAnvil::Serialize::ParserInterface::ParserConfig)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:12: multiple definition of `ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&, ThorsAnvil::Serialize::ParserInterface::ParserConfig)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:12: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getNextToken()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:21: multiple definition of `ThorsAnvil::Serialize::JsonParser::getNextToken()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:21: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getString[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:139: multiple definition of `ThorsAnvil::Serialize::JsonParser::getString[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:139: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getRawString[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:143: multiple definition of `ThorsAnvil::Serialize::JsonParser::getRawString[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:143: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::ignoreDataValue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:147: multiple definition of `ThorsAnvil::Serialize::JsonParser::ignoreDataValue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:147: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getKey[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:152: multiple definition of `ThorsAnvil::Serialize::JsonParser::getKey[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:152: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(short&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:162: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(short&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:162: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(int&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:163: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(int&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:163: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(long&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:164: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(long&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:164: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(long long&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:165: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(long long&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:165: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(unsigned short&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:167: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(unsigned short&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:167: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(unsigned int&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:168: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(unsigned int&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:168: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(unsigned long&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:169: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(unsigned long&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:169: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(unsigned long long&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:170: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(unsigned long long&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:170: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(float&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:172: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(float&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:172: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(double&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:173: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(double&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:173: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(long double&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:174: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(long double&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:174: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(bool&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:177: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(bool&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:177: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:182: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:182: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::isValueNull()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:187: multiple definition of `ThorsAnvil::Serialize::JsonParser::isValueNull()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:187: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getRawValue[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:192: multiple definition of `ThorsAnvil::Serialize::JsonParser::getRawValue[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:192: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::JsonPrinter(std::ostream&, ThorsAnvil::Serialize::PrinterInterface::PrinterConfig)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:112: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::JsonPrinter(std::ostream&, ThorsAnvil::Serialize::PrinterInterface::PrinterConfig)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:112: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::JsonPrinter(std::ostream&, ThorsAnvil::Serialize::PrinterInterface::PrinterConfig)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:112: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::JsonPrinter(std::ostream&, ThorsAnvil::Serialize::PrinterInterface::PrinterConfig)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:112: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::openDoc()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:119: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::openDoc()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:119: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::closeDoc()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:121: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::closeDoc()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:121: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::openMap()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:124: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::openMap()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:124: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::closeMap()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:129: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::closeMap()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:129: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::openArray(unsigned long)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:138: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::openArray(unsigned long)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:138: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::closeArray()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:143: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::closeArray()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:143: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:153: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:153: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(short)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:179: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(short)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:179: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(int)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:180: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(int)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:180: first defined here
collect2: error: ld returned 1 exit status
CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
project(sandbox)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BINARY_DIR ${PROJECT_SOURCE_DIR}/build)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
add_subdirectory(lib/pistache)
include_directories(include lib/odb/libodb lib/odb/libodb-pgsql lib/ThorsSerializer)
set(SOURCE_FILES src/sandbox.cpp
src/Security/authSecurity.cpp src/Entity/user.cpp
src/Service/serializerService.cpp
src/Endpoint/mainEndpoint.cpp
)
add_executable(sandbox ${SOURCE_FILES})
#add_library()
set(ODB_LIBRARIES
${CMAKE_CURRENT_SOURCE_DIR}/lib/odb/libodb/odb/.libs/libodb.a
)
target_link_libraries(sandbox pistache pthread ${ODB_LIBRARIES})