2013-08-17 3 views
0

J'ai un problème de liaison sous linux. Ceci est mon fichier CMake:Erreur de lien après avoir créé cmake

cmake_minimum_required(VERSION 2.6) 

# Locate GTest 
find_package(GTest REQUIRED Boost) 
include_directories(${GTEST_INCLUDE_DIRS}) 

file(GLOB info_model 

"../src/info_model/*.h" 
"../src/info_model/*.cpp" 
"../src/gcc_xml_parsing/*.h" 
"../src/gcc_xml_parsing/*.cpp" 
"../src/messages_filed_with_values/*.h" 
"../src/messages_filed_with_values/*.cpp" 

) 

# Link runTests with what we want to test and the GTest and pthread library 

add_library(info_model_lib STATIC ${info_model}) 

add_executable(runTests_xml unit/gcc_xml_parsing/ut_XMLFile.cpp) 
add_executable(runTests_hexDumpUtil unit/info_model/ut_HexDumpUtil.cpp) 
add_executable(runTests_cstruct unit/info_model/ut_CStruct.cpp) 
add_executable(runTests_primitive_type_field unit/info_model/ut_PrimitiveTypeField.cpp) 
add_executable(runTests_enumField unit/info_model/ut_EnumField.cpp) 
add_executable(runTests_ArrayOfFields unit/info_model/ut_ArrayType.cpp) 

target_link_libraries(runTests_xml ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread  boost_regex boost_thread info_model_lib) 
target_link_libraries(runTests_hexDumpUtil ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread boost_regex boost_thread info_model_lib) 
target_link_libraries(runTests_cstruct ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread boost_regex boost_thread info_model_lib) 
target_link_libraries(runTests_primitive_type_field ${GTEST_LIBRARIES}  ${GTEST_MAIN_LIBRARIES} pthread boost_regex boost_thread info_model_lib) 
target_link_libraries(runTests_enumField ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES}  pthread boost_regex boost_thread info_model_lib) 
target_link_libraries(runTests_ArrayOfFields ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread boost_regex boost_thread info_model_lib) 

Cependant, l'éditeur de liens moulinés une erreur qui commence (je n'ai pas fourni l'ensemble journal, car il est 5 fois plus grand que le ci-dessous):

libinfo_model_lib.a(XMLFile.cpp.o): In function `bool boost::regex_search<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::string>, __gnu_cxx::__normal_iterator<char const*, std::string>, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::string>)': 

Merci d'aider

Répondre

1

vous devez lier la vôtre bibliothèque avant boost :: regex

target_link_libraries(runTests_xml ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} info_model_lib pthread boost_regex boost_thread) 
+0

Cela fonctionne, merci beaucoup: D – friko

Questions connexes