dysonltd-zz / gts

A tool for visually tracking a moving target on a calibrated ground plane and recording position and angle in 2-dimensions.
GNU General Public License v3.0
25 stars 18 forks source link

linker - undefined reference to 'clock_gettime' #7

Closed rlrosa closed 11 years ago

rlrosa commented 11 years ago

hi,

i was having this issue:

Linking CXX executable ../bin/gts
/home/rela/work/dysonltd-gts/app/src/video/input/CaptureThread.cpp:99: error: undefined reference to 'clock_gettime'
collect2: ld returned 1 exit status
make[2]: *** [bin/gts] Error 1
make[1]: *** [app/CMakeFiles/gts.dir/all] Error 2
make: *** [all] Error 2

and solved it with this:

diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index dbb653e..9ae8a1b 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -185,7 +185,7 @@ if(MINGW)
 elseif(MSVC)
     target_link_libraries( gts ${OpenCV2_LIBRARIES} ${QT_LIBRARIES} Log4Qt strmiids.lib )
 elseif(UNIX)
-    target_link_libraries( gts ${OpenCV2_LIBRARIES} ${QT_LIBRARIES} ${UNICAP_LIBRARIES} Log4Qt )
+    target_link_libraries( gts ${OpenCV2_LIBRARIES} ${QT_LIBRARIES} ${UNICAP_LIBRARIES} Log4Qt rt )
 endif()

 # ----------------------------------------------------------------------------
@@ -229,7 +229,7 @@ if(GTS_TESTS)
         link_directories( ${gtest_BINARY_DIR} )
         target_link_libraries( gts_test ${OpenCV2_LIBRARIES} ${QT_LIBRARIES} Log4Qt gtest strmiids.lib )
     elseif(UNIX)
-        target_link_libraries( gts_test ${OpenCV2_LIBRARIES} ${QT_LIBRARIES} ${UNICAP_LIBRARIES} Log4Qt gtest )
+        target_link_libraries( gts_test ${OpenCV2_LIBRARIES} ${QT_LIBRARIES} ${UNICAP_LIBRARIES} Log4Qt gtest rt )
     endif()
 endif()

has this happened to you? is there some path or configuration i'm missing?

thanks! salú

akramhussein commented 11 years ago

Hi Salú,

Not an issue i've seen on Windows or Linux. I believe it's related to the version of GCC or possibly Linux distribution. Could you let me know which version you are running just for reference?

Either way, could you create a pull request as this will start a Travis CI build and verify it won't break anything. Afterwards, i'll look to merging it with the 'develop' branch.

Thanks for spotting it and letting me know. Akram

rlrosa commented 11 years ago

rela@yijie-ThinkPad-L412:~/work/dysonltd-gts$ gcc --version gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rela@yijie-ThinkPad-L412:~/work/dysonltd-gts$ uname -a Linux yijie-ThinkPad-L412 3.2.0-55-generic #85-Ubuntu SMP Wed Oct 2 12:29:27 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

pull request: https://github.com/dysonltd/gts/pull/8