. Advertisement .
..3..
. Advertisement .
..4..
As title, I am getting ld: symbol(s) not found for architecture x86_64 error. How can I fix it so the error goes away?
Here is my code:
g++ -L/opt/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc src/Config.o src/Features.o src/HaarFeature.o src/HaarFeatures.o src/HistogramFeatures.o src/ImageRep.o src/LaRank.o src/MultiFeatures.o src/RawFeatures.o src/Sampler.o src/Tracker.o src/main.o src/GraphUtils/GraphUtils.o -o struck
When I operate it and I received the error text:
Undefined symbols for architecture x86_64:
"cv::namedWindow(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&,
int)", referenced from:
_main in main.o "cv::split(cv::Mat const&, std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >&)",
referenced from:
ImageRep::ImageRep(cv::Mat const&, bool, bool, bool) in ImageRep.o "cv::imread(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&,
int)", referenced from:
_main in main.o "cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&,
cv::_InputArray const&)", referenced from:
LaRank::Debug() in LaRank.o
Tracker::Debug() in Tracker.o
_main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I appreciate any help from you.
Have you tried to run:
I hope it helps
I had a similar warning/error/failure when I was simply trying to make an executable from two different object files (main.o and add.o). The command was:
gcc -o exec main.o add.o
My program is C++. My problem was solved by the
g++
compilerg++ -o exec main.o add.o
These things were always my impression of
gcc
. It turns out that it doesn’t. I hope this helps someone else who is trying to find this error.