I've had issues in compiling DisplayImage.cpp, I've followed the tutorial here and to create a cmake file and generate executables, however, when I was compiling the problem with make it displays the following errors:
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 DisplayImage.cpp.o
"cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
_main in DisplayImage.cpp.o
"cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&)", referenced from:
_main in DisplayImage.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [DisplayImage] Error 1
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
make: *** [all] Error 2
I am running MacOS could anyone please help!
Thanks
Try adding
#include <opencv2/highgui/highgui_c.h>
to the top of DisplayImage.cpp code. Then compile and execute again.
Hope it works! I just tried and verified it myself now.
Related
When I try to convert my program to run in netanim I get the following error.
Undefined symbols for architecture arm64:
"ns3::AnimationInterface::SetConstantPosition(ns3::Ptr<ns3::Node>, double, double, double)", referenced from:
experiment(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in wifi-hidden-terminal.cc.16.o
"ns3::AnimationInterface::AnimationInterface(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
experiment(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in wifi-hidden-terminal.cc.16.o
"ns3::AnimationInterface::~AnimationInterface()", referenced from:
experiment(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in wifi-hidden-terminal.cc.16.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Waf: Leaving directory `/Users/nithindeepkumar/Mtech/Wireless/ns-allinone-3.35/ns-3.35/build'
Build failed
-> task in 'wifi-hidden-terminal' failed with exit status 1 (run with -v to display more information)
The code I try to run is :
anim.SetConstantPosition(nodes.Get(0),1.0, 2.0 );
anim.SetConstantPosition(nodes.Get(1), 3.0 , 2.0 );
anim.SetConstantPosition(nodes.Get(2), 4.0, 2.0);
I am running ns3-3.35.
I'm trying to use GRANSAC(Generic RANSAC) from this github repository. https://github.com/drsrinathsridhar/GRANSAC
When I build with cmake, this error happens and I don't know how to solve it.
Undefined symbols for architecture x86_64: "_omp_get_max_threads",
referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o
GRANSAC::RANSAC::RANSAC() in LineFittingSample.cpp.o "_omp_get_thread_num", referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o "_omp_set_dynamic", referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o "_omp_set_num_threads", referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code
1 (use -v to see invocation) make[2]: * [LineFittingSample] Error 1
make[1]: * [CMakeFiles/LineFittingSample.dir/all] Error 2 make: ***
[all]
Error 2
Environment: MacOS Mojave ver 10.14.16
I am trying to build a conan source with dependency, I am getting
Undefined symbols for architecture x86_64:
I am trying to use geolite2pp in a c++ project, But I am getting this error
Here is content of conanfile.py
class AppConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "geolite2pp/0.0.1-2561#avantize/stable"
generators = "cmake"
Got error, while running
conan install -s build_type=Release --build=missing
Undefined symbols for architecture x86_64:
"_MMDB_aget_value", referenced from:
GeoLite2PP::DB::get_field(MMDB_lookup_result_s*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&) in GeoLite2PP.cpp.o
"_MMDB_close", referenced from:
GeoLite2PP::DB::~DB() in GeoLite2PP.cpp.o
GeoLite2PP::DB::~DB() in GeoLite2PP.cpp.o
"_MMDB_free_entry_data_list", referenced from:
GeoLite2PP::DB::to_json(MMDB_entry_data_list_s*) in GeoLite2PP.cpp.o
"_MMDB_get_entry_data_list", referenced from:
GeoLite2PP::DB::lookup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in GeoLite2PP.cpp.o
"_MMDB_get_metadata_as_entry_data_list", referenced from:
GeoLite2PP::DB::get_metadata() in GeoLite2PP.cpp.o
"_MMDB_lib_version", referenced from:
GeoLite2PP::DB::get_lib_version_mmdb() const in GeoLite2PP.cpp.o
"_MMDB_lookup_string", referenced from:
GeoLite2PP::DB::lookup_raw(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in GeoLite2PP.cpp.o
"_MMDB_open", referenced from:
GeoLite2PP::DB::DB(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in GeoLite2PP.cpp.o
"_MMDB_strerror", referenced from:
GeoLite2PP::ErrorCategory::message(int) const in GeoLite2PP_error_category.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [src-lib/CMakeFiles/geolite2++s.dir/build.make:99: src-lib/libgeolite2++.dylib] Error 1
[ 75%] Built target geolite2++
gmake[1]: *** [CMakeFiles/Makefile2:93: src-lib/CMakeFiles/geolite2++s.dir/all] Error 2
I'm trying to install mydumper but the make step complains about undefine symbols. I've searched other questions where they talk about linking your object file to make sure the compiler can find the methods it needs. However this is just plain installation and I am not a C guy. Any pointer is highly appreciated. Here's the error I am seeing:
[ 16%] Linking C executable myloader
Undefined symbols for architecture x86_64:
"_CFRelease", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFStringGetCString", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFStringGetCStringPtr", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFStringGetLength", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFURLCopyFileSystemPath", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_CFURLCreateFromFSRef", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"_FSFindFolder", referenced from:
_find_folder in libglib-2.0.a(libglib_2_0_la-gutils.o)
"std::terminate()", referenced from:
___clang_call_terminate in libmysqlclient.a(ssl.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make[2]: *** [myloader] Error 1
make[1]: *** [CMakeFiles/myloader.dir/all] Error 2
make: *** [all] Error 2
I was working on some computer vision code with OpenCV, and wanted to try running OpenCV by compiling the OpenCV tutorial code using CMake. When I tried to compile and run the basic display_image program, it compiled successfully and ran(I added a CMakeLists.txt file and ran cmake . and then make in Terminal. However, when I applied the same procedure to run a few other programs, it didn't work.
I got the following error message
$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/censam/OpenCV/Vision Code/Examples/grabcut
$ make
Linking CXX executable grabcut
Undefined symbols for architecture x86_64:
"cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, >
std::__1::allocator<char> > const&, int)", referenced from:
_main in grabcut.cpp.o
"cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, >
std::__1::allocator<char> > const&, cv::_InputArray const&)", referenced from:
GCApplication::showImage() const in grabcut.cpp.o
"cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, >
std::__1::allocator<char> > const&, std::__1::basic_string<char, >
std::__1::char_traits<char>, std::__1::allocator<char> > const&, >
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >
const&, int)", referenced from:
getBinMask(cv::Mat const&, cv::Mat&) in grabcut.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [grabcut] Error 1
make[1]: *** [CMakeFiles/grabcut.dir/all] Error 2
make: *** [all] Error 2
My CMakeLists.txt file is as follows:
cmake_minimum_required(VERSION 2.8)
project( grabcut )
find_package( OpenCV REQUIRED )
add_executable( grabcut grabcut.cpp )
target_link_libraries( grabcut ${OpenCV_LIBS} )
May I know why this happens?I suspect it could be because CMake hasn't linked the required libraries during compiling. When I tried this with XCode, I got the same result, but I prefer to use CMake so that I can port my code over to linux systems more easily.
I found the following link Linking OpenCV 2.3 program in Mac OS X Lion: symbol(s) not found for architecture x86_64 also had the same problem, but the issue doesn't seem to have been resolved.
Any help on how I can get my program to compile and run using CMake in OSX Mavericks will be much appreciated.
Change the compiler from clang to g++-4.2.
A more detailed explain could be find here.