vendredi 23 février 2018

LINK 2019 Error when I try to use multiple files [duplicate]

This question already has an answer here:

I think the tittle says everything, here are my files and implementation:

//myFile.h
#pragma once
#ifndef MYFILE_H
#define MYFILE_H
#include "stdafx.h"
#include <"SoManyOthersHeaders">
using namespace std;

template <class tData>
tData myFunc(string var1, string var2, string var3);

#endif

 

//myFile.cpp
#include "stdafx.h"
#include "myFile.h"

template <class tData>
tData myFunc(string var1, string var2, string var3){
    //code here
    return x;
}

 

//main.cpp
#include "stdafx.h"
#include <"SoManyOthersHeaders">
#include "myFile.h"
using namespace std;

int main(){
    bool myVar = myFunc<bool>("help", "stackoverflow", "!");
}

Error:

LNK2019 unresolved external symbol "bool __cdecl myFunc(class std::basic_string,class std::allocator >,class std::basic_string,class std::allocator >,class std::basic_string,class std::allocator >)" (??$myFunc@_N@@YA_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z) referenced in function _main MyProyectName C:\Users\MyName\Documents\Visual Studio 2017\Projects\MyProyectName\MyProyectName\main.obj

Aucun commentaire:

Enregistrer un commentaire