помогите, у меня тут повторное определение, я не пойму что делать, #pragma once написал, не помогает
мне надо сгенерировать много рандомных названий, но ошибка компиляции все портит.
с++17
выдает ошибку:
Severity Code Description Project File Line Suppression State
Error LNK2005 "class std::mersenne_twister_engine<unsigned __int64,64,312,156,31,-5403634167711393303,29,6148914691236517205,17,8202884508482404352,37,-2270628950310912,43,6364136223846793005> kapt0xa::default_randomizer" (?default_randomizer@kapt0xa@@3V?$mersenne_twister_engine@_K$0EA@$0BDI@$0JM@$0BP@$0?EKPNJAKFFGJJOGBH@$0BN@$0FFFFFFFFFFFFFFFF@$0BB@$0HBNGHPPPONKGAAAA@$0CF@$0?IBBCAAAAAAAAA@$0CL@$0FIFBPECNEMJFHPCN@@std@@A) already defined in main.obj testing_stuff C:\Users\HP\source\repos\testing_stuff\testing_stuff\random_string.obj 1
main.cpp:
#include "random_string.h"
#include <fstream>
using namespace std;
using namespace kapt0xa;
int main()
{
ofstream fout("random_busnames.txt");
auto words = MakeRandomWords(1000);
auto phrases = MakeRandomPhrases(500, words);
UnorderedUnique(phrases);
SaveStrings(phrases, fout);
}
random_string.h:
#pragma once
#include <string>
#include <random>
#include <iostream>
#include <vector>
#include <ctime>
namespace kapt0xa
{
using std::string;
using std::ostream;
using std::istream;
using strings = std::vector<string>;
using namespace std::string_literals;
using Randomizer = std::mt19937_64;
Randomizer default_randomizer(std::time(0));
struct AvailableChars
{
const string alphabet = "abcdefghijklmnopqrstuvwxyz"s;
const string caps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"s;
const string digits = "0123456789"s;
const string punctuators = " ---/"s;
char RandomLetter(Randomizer& randomizer) const;
char RandomGrandLetter(Randomizer& randomizer) const;
char RandomDigit(Randomizer& randomizer) const;
char RandomPunctuator(Randomizer& randomizer) const;
} const default_available_chars;
string MakeRandomWord(Randomizer& randomizer = default_randomizer, size_t min_size = 4, size_t max_size = 10, const AvailableChars& letters = default_available_chars);
strings MakeRandomWords(size_t count, Randomizer& randomizer = default_randomizer, size_t min_size = 4, size_t max_size = 10, const AvailableChars& letters = default_available_chars);
string MakeRandomPhrase(const strings& words, size_t min_word_count = 1, size_t max_word_count = 4, Randomizer& randomizer = default_randomizer, const AvailableChars& letters = default_available_chars);
strings MakeRandomPhrases(size_t count, const strings& words, size_t min_word_count = 1, size_t max_word_count = 4, Randomizer& randomizer = default_randomizer, const AvailableChars& letters = default_available_chars);
strings LoadStrings(istream& in);
void SaveStrings(const strings& data, ostream& out);
strings& UnorderedUnique(strings& data);
}
random_string.cpp в коментах скину если надо