Я использую Ubuntu 17.04 LTS наряду с gcc 7.3 alognside CMake.К сожалению, я получаю эту ошибку:
[ 37%] Building CXX object source/server/Scripts/CMakeFiles/L5RP.dir/CarDealer/cardealer.cpp.o
/home/kkraujelis/Desktop/L5RP/ragemp/source/server/Scripts/CarDealer/cardealer.cpp:10:30: error: expected constructor, destructor, or type conversion before ‘(’ token
CarDealer::CarOffer::CarOffer(CarDealer::CarDealer const* dealer, uint32_t price, std::string const& model, double fuelUsagePerKilo) {
^
source/server/Scripts/CMakeFiles/L5RP.dir/build.make:182: recipe for target 'source/server/Scripts/CMakeFiles/L5RP.dir/CarDealer/cardealer.cpp.o' failed
make[2]: *** [source/server/Scripts/CMakeFiles/L5RP.dir/CarDealer/cardealer.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:194: recipe for target 'source/server/Scripts/CMakeFiles/L5RP.dir/all' failed
make[1]: *** [source/server/Scripts/CMakeFiles/L5RP.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Везде, где я читал об этом, это оказалось основной синтаксической ошибкой или многими другими вещами.Вероятно, я слепой, однако каждый раз, когда я проверял код, он казался нормальным.
Заголовок:
#pragma once
#define SIMEONS_CARDEALER 0
namespace L5RP {
namespace Scripts {
namespace CarDealer {
class CarDealer;
class CarDealerScript;
class CarOffer {
CarDealer const* dealer;
uint32_t price;
std::string model;
double fuelUsagePerKilo;
public:
CarOffer(
CarDealer const* dealer,
uint32_t price,
std::string const& model,
double fuelUsagePerKilo
);
CarDealer const* getDealer() const;
uint32_t getPrice() const;
std::string const& getModelName() const;
uint32_t getModel() const;
double getFuelUsagePerKilo() const;
};
/*** Some other classes ***/
}
}
}
#include "Simeons/simeons.h"
Источник:
#include "../scripts.h"
using namespace L5RP;
using namespace L5RP::Scripts;
using namespace L5RP::Scripts::Government;
using namespace L5RP::Scripts::CarDealer;
using namespace L5RP::Scripts::Character;
using namespace L5RP::Scripts::VehicleLogic;
CarDealer::CarOffer::CarOffer(CarDealer::CarDealer const* dealer, uint32_t price, std::string const& model, double fuelUsagePerKilo) {
this->dealer = dealer;
this->price = price;
this->model = model;
this->fuelUsagePerKilo = fuelUsagePerKilo;
}