I have a file with the extension A.cpp which has templates that I would like to use in the B.cpp file . I tried putting the following in B.cpp :
#include "A.cpp"
But I get the following error:
C:\Users\friky\Documents\Octavo Semestre\Inteligencia Artificial\Arbol.cpp In function 'int main(int, char**)':
3 5 C:\Users\friky\Documents\Octavo Semestre\Inteligencia Artificial\Arbol.cpp [Error] redefinition of 'int main(int, char**)'
1 0 C:\Users\friky\Documents\Octavo Semestre\Inteligencia Artificial\Arbol.cpp In file included from C:\Users\friky\Documents\Octavo Semestre\Inteligencia Artificial\Arbol.cpp
286 5 C:\Users\friky\Documents\Octavo Semestre\Inteligencia Artificial\arbolABB-templ.cpp [Error] 'int main(int, char**)' previously defined here
I think it's because by including the "A.cpp" file there is an ambiguity between the "main" functions of each.
I recommend you put what you want to use in those two files in a "Templates.h" file and import it in both.
I hope it helps.
A greeting.