Gtest query after adding library #4519
Unanswered
rkadam61001
asked this question in
Community Help
Replies: 1 comment
-
To fix your issue with multiple definitions in GTest, follow these steps:
This should resolve the multiple definition errors. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am new to GTest .I have adoubt regarding gtest;after adding a library,in CMakeLists.txt..I am getting the following error
main'; GTest/GTestCTCLManager/CMakeFiles/GTEST_CTCLManager.dir/src/main.cpp.o:/home/greek/Workspace_develop/fusion_rhl_8/build/../GTest/GTestCTCLManager/src/main.cpp:10: first defined here
[build] /opt/rh/gcc-toolset-11/root/usr/bin/ld: lib/libCTCLManager_Gtest.a(main.cpp.o):(.bss+0x4e3): multiple definition of
__odr_asan._ZN2el14elCrashHandlerE'; GTest/GTestCTCLManager/CMakeFiles/GTEST_CTCLManager.dir/src/main.cpp.o:(.bss+0x124a0): first defined here [build] /opt/rh/gcc-toolset-11/root/usr/bin/ld: lib/libCTCLManager_Gtest.a(main.cpp.o):(.bss+0x4e4): multiple definition of
__odr_asan._ZN2el4base9elStorageE'; GTest/GTestCTCLManager/CMakeFiles/GTEST_CTCLManager.dir/src/main.cpp.o:(.bss+0x124a1): first defined here
rc/pendingordersetting.cpp)
link_directories(${PROJECT_NAME} ${Boost_LIBRARY_DIR})
add_executable(${PROJECT_NAME} ${CTCLManager_SOURCES})
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(${PROJECT_NAME} PRIVATE DEBUG_BUILD=1)
else()
endif()
target_include_directories(${PROJECT_NAME} PUBLIC includes ${Boost_LIBRARY_DIR})
file(COPY src/CTCLManager.conf DESTINATION ${CMAKE_SOURCE_DIR}/build/bin)
target_link_libraries(${PROJECT_NAME} logging greekutils CommonIncludes GreekSecurity ShmManager boost_filesystem boost_atomic)
add_library(${PROJECT_NAME}_Gtest ${CTCLManager_SOURCES})
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(${PROJECT_NAME}_Gtest PRIVATE DEBUG_BUILD=1)
else()
endif()
target_include_directories(${PROJECT_NAME}_Gtest PUBLIC includes ${Boost_LIBRARY_DIR})
file(COPY src/CTCLManager.conf DESTINATION ${CMAKE_SOURCE_DIR}/build/bin)
target_link_libraries(${PROJECT_NAME}_Gtest logging greekutils CommonIncludes GreekSecurity ShmManager boost_filesystem boost_atomic)
Beta Was this translation helpful? Give feedback.
All reactions