J'ai installé et intégré dernière version de vcpkg:vcpkg ne fonctionne pas pour le test google
e:\work\vcpkg>vcpkg version
Vcpkg package management program version 0.0.65-692a363701156f1bc319306fbde93fb6748325f6
See LICENSE.txt for license information.
e:\work\vcpkg>vcpkg integrate install
Applied user-wide integration for this vcpkg root.
All C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.
J'ai installé test de google:
e:\work\vcpkg>vcpkg list
gtest:x64-windows 1.8 GoogleTest and GoogleMock testing frameworks.
gtest:x86-windows 1.8 GoogleTest and GoogleMock testing frameworks.
J'inclus gtest.h
dans mon projet dans Visual Studio 2015 Mise à jour 3 :
#include <gtest/gtest.h>
Il compile très bien, mais je dois les erreurs de l'éditeur de liens:
1>main.obj : error LNK2001: unresolved external symbol "void __cdecl testing::InitGoogleTest(int *,char * *)" ([email protected]@@[email protected])
1>main.obj : error LNK2001: unresolved external symbol "public: int __cdecl testing::UnitTest::Run(void)" ([email protected]@[email protected]@QEAAHXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: static class testing::UnitTest * __cdecl testing::UnitTest::GetInstance(void)" ([email protected]@[email protected]@[email protected])
Apparemment, Visual Studio ne sait pas qu'il doit lier avec gtest.lib
. Et je ne peux pas comprendre pourquoi. Vcpkg dit seulement que "le lien sera géré automatiquement". Aucune idée de comment cela va se faire.
Dans « Dépendances des bibliothèques supplémentaires » de mon projet, je peux voir ces valeurs héritées:
$(VcpkgRoot)lib
$(VcpkgRoot)lib\manual-link
Et $(VcpkgRoot)
est résolu à e:\work\vcpkg\installed\x64-windows\
. Il semble donc que l'intégration a réussi. Mais comment Visual Studio sait qu'il devrait lier avec gtest.lib
?
Notez que si j'ajoute manuellement gtest.lib
à "Dépendances supplémentaires", tout fonctionne correctement et gtest.dll
est automatiquement copié dans le répertoire de sortie.
Donc, la manière recommandée pour lier 'gtest' est comme je l'ai fait: en fait l'ajouter à" Dépendances supplémentaires ", non? – Mikhail
Oui, je le pense. – traversaro