Error:
"subhook_unprotect(void*, unsigned long)", referenced from:
_subhook_new in subhook-9679a6.o
ld: symbol(s) not found for architecture x86_64
Linking command: g++ -dynamiclib -fPIC -v -o finalcalling.dylib finalversion.cpp /Users/~/Desktop/c/subhook-master/subhook.c -std=c++11
After going through my code I found that subhook_unprotect(void*, unsigned long) is not even in my code.
If this is your code https://github.com/Zeex/subhook then it seems you are supposed to also include subhook_unix.c in your build. That file does define subhook_unprotect. So does subhook_windows.c but I'm assuming you are on a unix like platform.
Related
I have a program that i am trying to compile from my project directory and haven't been able to wrap my head around the following error
My compilation command
g++ grades.cpp -o grades
I see the following error
Undefined symbols for architecture x86_64:
"tbb::task_scheduler_init::initialize(int, unsigned long)", referenced from:
tbb::task_scheduler_init::task_scheduler_init(int, unsigned long) in grades-9c8d1a.o
"tbb::task_scheduler_init::terminate()", referenced from:
tbb::task_scheduler_init::~task_scheduler_init() in grades-9c8d1a.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 am not sure how to debug this error.
You need to link against the tbb library you are tying to use,
g++ grades.cpp -o grades -ltbb
I am trying to add my own user defined functions to mySQL following the instructions:
enter link description here
But it does not work so far in my mac OS X mavericks.
I first do:
gcc -Wall -I /usr/local/mysql/include -I /usr/local/include -c udf_median.cc -o udf_median.o
Then I try:
ld -shared -o udf_median.so udf_median.o
But I get an error:
ld: unknown option: -shared
Is there anyway to share a library in Mac os X?
I tried as suggested in answer and I geT:
ld -dylib -o udf_median.dylib udf_median.o
ld: warning: -macosx_version_min not specified, assuming 10.8
Undefined symbols for architecture x86_64:
"__ZdlPv", referenced from:
_median_deinit in udf_median.o
"__Znwm", referenced from:
_median_init in udf_median.o
"_free", referenced from:
_median_deinit in udf_median.o
_median_reset in udf_median.o
"_malloc", referenced from:
_median_reset in udf_median.o
"_qsort", referenced from:
_median in udf_median.o
"_realloc", referenced from:
_median_add in udf_median.o
"_strcpy", referenced from:
_median_init in udf_median.o
ld: symbol(s) not found for inferred architecture x86_64
The Mac OS X linker uses the -dylib flag for this. Additionally, the platform uses the .dylib extension for shared libraries, not .so.
ld -dylib -o udf_median.dylib udf_median.o
Since you are invoking the linker directly, you may also need to add flags to link against libraries that are normally implicit (e.g, -lc for libc). Alternatively, if your library links against functions present in the parent executable, you may need to use other linker options to allow this to take place.
I'm following this:
http://sadeepj.blogspot.com.br/2012/03/installing-and-configuring-opencv-to.html
I had a problem, compiling. But I already fixed it, modifying 2 files...
Now I'm trying to run that example.
And I get this error message:
Ld
/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2
normal x86_64
cd /Users/eduardoreis/Documents/XCodeDevelopment/DemoOpenCV2
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
-L/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug
-F/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug
-filelist /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2.LinkFileList
-mmacosx-version-min=10.8 -stdlib=libc++ -lopencv_core.2.4.6 -lopencv_highgui.2.4.6 -Xlinker -dependency_info -Xlinker /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2_dependency_info.dat
-o /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2
ld: library not found for -lopencv_core.2.4.6 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
I follows all steps already. And I can't even build it.
Please, help me.
[Before someone says that it is a duplicated post, I know it, here is the original one:
C++ linker errors with OpenCV.
I'm sorry. But I can't even comment on that one :/ ]
Wow, Finally solved:
Some considerations:
Realize that even it is looking for -l opencv_core.2.4.6, the
compiler will get the right file, if it is added correctly with other
name, in this case libopencv_core.2.4.dylib
I was adding the files with Project>Add files to... and then creating a group and dragging the files into the group. This was messing up the linkings in Project>Link Binary with Libraries. So I had to do it again by dragging the files in the group into that spot.
After theses things I had the situation where I had the two files (core and highgui) and 4 errors:
Ld
/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2
normal x86_64
cd /Users/eduardoreis/Documents/XCodeDevelopment/DemoOpenCV2
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
-L/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug
-L/Users/eduardoreis/Downloads/opencv-2.4.6.1/build/lib/Debug -L/usr/local/lib/python2.7/site-packages -L/usr/local/lib/python2.7/site-packages/PyQt4 -L/usr/local/lib/wine -L/usr/local/Cellar/wine/1.4.1/lib -L/usr/local/Cellar/qt/4.8.5/lib -L/usr/local/Cellar/qscintilla2/2.7.1/lib -L/usr/local/Cellar/libicns/0.8.1/lib -L/usr/local/Cellar/jasper/1.900.1/lib -L/usr/local/Cellar/jpeg/8d/lib -L/usr/local/Cellar/little-cms/1.19/lib -L/usr/local/Cellar/libpng/1.5.14/lib -L/usr/local/Cellar/libtiff/4.0.3/lib -F/Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug
-F/usr/local/lib -filelist /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2.LinkFileList
-mmacosx-version-min=10.8 -stdlib=libc++ -lopencv_core.2.4 -lopencv_highgui.2.4 -Xlinker -dependency_info -Xlinker /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Intermediates/DemoOpenCV2.build/Debug/DemoOpenCV2.build/Objects-normal/x86_64/DemoOpenCV2_dependency_info.dat
-o /Users/eduardoreis/Library/Developer/Xcode/DerivedData/DemoOpenCV2-cqudsdzwopsadacnkbwrsxuncofg/Build/Products/Debug/DemoOpenCV2
Undefined symbols for architecture x86_64:
"cv::namedWindow(std::__1::basic_string, std::__1::allocator > const&,
int)", referenced from:
_main in main.o "cv::imread(std::__1::basic_string, std::__1::allocator > const&,
int)", referenced from:
_main in main.o "cv::imshow(std::__1::basic_string, std::__1::allocator > const&,
cv::_InputArray const&)", referenced from:
_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)
Then (thanks God and some days of googling) I got this:
Select your project, go to the Build Settings tab, filter by c++
standard library, and set this parameter to libstdc++ (GNU C++
standard library).
from: Undefined symbols for architecture x86_64 error when linking OpenCV in Xcode
And finally it was sunny again in my code environment...
I am using Lear's implementation of the Gist descriptor for a project which can be found here: http://lear.inrialpes.fr/software.
I am writing an application in c++ and I want to use this library. I am having issues though with the makefile and linking in general.
These commands give me no errors:
g++ -c standalone_image.c -o standalone_image.o
g++ -c gist.c -o gist.o
However, this line
g++ compute_gist.c `pkg-config --cflags --libs opencv`
gives me the following error
Undefined symbols for architecture x86_64:
"color_gist_scaletab(color_image_t*, int, int, int const*)", referenced from:
_main in ccMFYbAU.o
"color_image_delete(color_image_t*)", referenced from:
_main in ccMFYbAU.o
"color_image_new(int, int)", referenced from:
load_ppm(char const*)in ccMFYbAU.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
I have the Mosaic c++ code in a different directory. I also tried to compile gist and standalone_image seperately, copy into the mosaic directory, and compile the Mosaic code.
Which gives me the following error:
Undefined symbols for architecture x86_64:
"color_gist_scaletab(color_image_t*, int, int, int const*)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [mosaic] Error 1
I really want to use this library in my project, but I can't figure out a way to incorporate it in my c++.
Any help is GREATLY appreciated! Thanks!
Edit: I am using Mac Lion with:
gcc + g++ version: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
The lear library also uses the FFTW3 library that should work with C and C++.
The problem was that I needed the extern around the gist include, but the linking that was done in the Makefile was also wrong. It works now. :)
When trying to compile the following file in xcode:
http://openkinect.org/wiki/C%2B%2BOpenCvExample
I get these errors:
Ld build/Debug/KinectOpenCV normal x86_64
cd "/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV"
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang++ -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk "-L/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV/build/Debug" "-F/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV/build/Debug" -filelist "/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV/build/KinectOpenCV.build/Debug/KinectOpenCV.build/Objects-normal/x86_64/KinectOpenCV.LinkFileList" -mmacosx-version-min=10.7 -lopencv_core.2.3.2 -lopencv_highgui.2.3.2 -lfreenect.0.0.1 -framework GLUT -framework OpenGL -o "/Users/Scott/Dropbox/Project/KinectOpenCV/KinectOpenCV/build/Debug/KinectOpenCV"
Undefined symbols for architecture x86_64:
"_freenect_find_video_mode", referenced from:
freenect_threadfunc(void*) in main.o
"_freenect_set_video_mode", referenced from:
freenect_threadfunc(void*) in main.o
"_freenect_find_depth_mode", referenced from:
freenect_threadfunc(void*) in main.o
"_freenect_set_depth_mode", referenced from:
freenect_threadfunc(void*) in main.o
"_freenect_select_subdevices", referenced from:
_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've been trying everything I can think off to resolve the issue but no joy. I've tried compiling for specific architectures (32 bit or 64), I've tried relinking all the libraries and other such measures like starting a new project and importing everything again.
Sounds like you need to rebuild libfreenect.
I'd suggest following the directions on this tutorial and once you have everything re-installed, run that nm test again and see if the symbols finally appear.
If they don't, grep through the library source and see if they are defined and simply conditionalized out for some reason.