2010-10-20 4 views
4

J'ai compilé mes bibliothèques boost selon le guide trouvé here et essayé d'utiliser la bibliothèque du système de fichiers boost.Problème liant les bibliothèques boost dans Visial Studio 2010.

Quand j'ajoute #include <boost\filesystem\operations.hpp> je reçois les erreurs suivantes:

error LNK2028: unresolved token (0A00009A) "class boost::system::error_code __clrcall boost::filesystem2::detail::dir_itr_close(void * &)" ([email protected]@[email protected]@@[email protected]@[email protected]@Z) referenced in function "public: __clrcall boost::filesystem2::detail::dir_itr_imp<class boost::filesystem2::basic_path<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem2::path_traits> >::~dir_itr_imp<class boost::filesystem2::basic_path<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem2::path_traits> >(void)" ([email protected][email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@@@[email protected]@[email protected]@[email protected]) 
error LNK2028: unresolved token (0A0000A2) "class boost::system::error_category const & __clrcall boost::system::generic_category(void)" ([email protected]@[email protected]@[email protected]@XZ) referenced in function "void __clrcall `anonymous namespace'::`dynamic initializer for 'void __clrcall boost::system::posix_category::A0x6367c629(void)''(void)" ([email protected][email protected]@[email protected]@[email protected][email protected]@$$FYMXXZ) 
error LNK2028: unresolved token (0A0000A3) "class boost::system::error_category const & __clrcall boost::system::system_category(void)" ([email protected]@[email protected]@[email protected]@XZ) referenced in function "void __clrcall `anonymous namespace'::`dynamic initializer for 'void __clrcall boost::system::native_ecat::A0x6367c629(void)''(void)" ([email protected][email protected]@[email protected]@[email protected][email protected]@$$FYMXXZ) 
error LNK2019: unresolved external symbol "class boost::system::error_code __clrcall boost::filesystem2::detail::dir_itr_close(void * &)" ([email protected]@[email protected]@@[email protected]@[email protected]@Z) referenced in function "public: __clrcall boost::filesystem2::detail::dir_itr_imp<class boost::filesystem2::basic_path<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem2::path_traits> >::~dir_itr_imp<class boost::filesystem2::basic_path<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct boost::filesystem2::path_traits> >(void)" ([email protected][email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@[email protected]@@@[email protected]@[email protected]@[email protected]) 
error LNK2019: unresolved external symbol "class boost::system::error_category const & __clrcall boost::system::generic_category(void)" ([email protected]@[email protected]@[email protected]@XZ) referenced in function "void __clrcall `anonymous namespace'::`dynamic initializer for 'void __clrcall boost::system::posix_category::A0x6367c629(void)''(void)" ([email protected][email protected]@[email protected]@[email protected][email protected]@$$FYMXXZ) 
error LNK2019: unresolved external symbol "class boost::system::error_category const & __clrcall boost::system::system_category(void)" ([email protected]@[email protected]@[email protected]@XZ) referenced in function "void __clrcall `anonymous namespace'::`dynamic initializer for 'void __clrcall boost::system::native_ecat::A0x6367c629(void)''(void)" ([email protected][email protected]@[email protected]@[email protected][email protected]@$$FYMXXZ) 

Si je compile sans inclure operations.hpp cela fonctionne très bien. La chose est que lorsque j'utilise #define BOOST_LIB_DIAGNOSTIC Il montre qu'il est un lien dans les bibliothèques Boost correctement:

Linking to lib file: libboost_filesystem-vc100-mt-gd-1_44.lib 
Linking to lib file: libboost_system-vc100-mt-gd-1_44.lib 
+1

Excellentes suggestions: http://stackoverflow.com/questions/2629421/how-to-use-boost-in-visual-studio-2010 – karlphillip

Répondre

1

Dans les options du projet (au groupe d'options de linker) ajoutez les bibliothèques manquantes dans les dépendances, et ajouter le chemin pour stimuler bibliothèques dans les répertoires supplémentaires. Ou, pour activer la liaison automatique (si vous avez compilé boost en tant que DLL), définissez BOOST_ALL_DYN_LINK dans les symboles du préprocesseur dans les options C++ du projet.

Questions connexes