Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking error #6

Open
chaiein opened this issue Mar 16, 2017 · 1 comment
Open

Linking error #6

chaiein opened this issue Mar 16, 2017 · 1 comment

Comments

@chaiein
Copy link

chaiein commented Mar 16, 2017

[100%] Linking CXX executable TestLineMatchingAlgorithm
CMakeFiles/TestLineMatchingAlgorithm.dir/TestLineMatchingAlgorithm.cpp.o: In function main': TestLineMatchingAlgorithm.cpp:(.text.startup+0x101): undefined reference to cv::imread(cv::String const&, int)'
TestLineMatchingAlgorithm.cpp:(.text.startup+0x211): undefined reference to cv::imread(cv::String const&, int)' TestLineMatchingAlgorithm.cpp:(.text.startup+0x877): undefined reference to cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator > const&)'
TestLineMatchingAlgorithm.cpp:(.text.startup+0x910): undefined reference to `cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator > const&)'
collect2: error: ld returned 1 exit status
CMakeFiles/TestLineMatchingAlgorithm.dir/build.make:95: recipe for target 'TestLineMatchingAlgorithm' failed
make[2]: *** [TestLineMatchingAlgorithm] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/TestLineMatchingAlgorithm.dir/all' failed
make[1]: *** [CMakeFiles/TestLineMatchingAlgorithm.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

How to solve this problem?

@jessicajie
Copy link

hello. I solved this problem by modifying the opencv version.
Because I installed two versions of opencv,the one is opencv-2.4.9,the other one is opencv-3.1.0.

Resolvent:

Modify cmakelist.txt:
add :set(OpenCV_DIR "/home/wj/opencv-3.1.0/build/") //this is your opencv-3.1.0's position
find_package( OpenCV REQUIRED )
TARGET_LINK_LIBRARIES(LineMatchingLib ${OpenCV_LIBS} )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants