Closed LoshkinOleg closed 4 years ago
Update: C'est pcq le .cpp est pas inclu lors de la compilation. J'ai essayé de remettre la definition du constructeur dans le header et l'erreur disparait. J'ai créé un map.cpp dans src/mathematics/map.cpp (mathematics est un nouveau dossier).
Edit #1: Dans src/CMakeLists.txt on a bien la ligne:
file(GLOB_RECURSE Neko_MATH_SRC src/mathematics/*.cpp include/mathematics/*.h)
Donc ça deverait faire le link avec le cpp non? J'ai bien vérifié que le nom du dossier est identique au celui dans src/CMakeLists.txt
Voilà un screenshot des fichiers:
Edit #2: Je crois qu'il arrive bien à include le .cpp mais il comprends pas que ce qui se trouve dans map.cpp est une définition de la déclaration qui est dans map.h. Il croit que c'est une fonction statique, ya un pb avec la manière dont j'ai déclaré l'implémentation des fonctions...
Je crois que j'ai trouvé ma réponse... je peux pas séparer ça entre un .h et un .cpp: https://stackoverflow.com/questions/8752837/undefined-reference-to-template-class-constructor
C'est ça :)
Je suis en train de refactoriser la classe FixedMap selon les feedbacks d'hier. J'ai créé un google test pour la tester. Lorsque je lance la compilation, j'ai cette erreur:
J'ai l'impression qu'il n'arrive pas à instancier la classe templatisée.
Voici le test_map.cpp:
Le header:
Et le cpp:
Si vous avez du feedback sur la manière d'implémenter les fonctions d'iterators d'ailleurs c'est aussi le bienvenu ( begin(), end(), cbegin(), cend() ) .