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
Related
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.
I'm trying to compile a projet with a makefile but I get this error message :
g++ testVecteur2D.o Vecteur2D.o -o testVecteur2D
ld: warning: ignoring file Vecteur2D.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file testVecteur2D.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
Undefined symbols for architecture arm64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [testVecteur2D] Error 1
my code is working on other computer so I don't understand why it is not on mine. For information I'm using de new m1 Mac maybe it has something to do with it.
I have downloaded OpenMPI, but after trying to run a simple parallelized Hello world program I get the following error:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
I guess there is a problem with the compiler because I struggled quite a lot to install OpenMPI.
In order to get that error I typed from the terminal:
mpifort -o hello.f90
Someone can help me?
I've been trying to build UETorch for OSX 10.12 using Xcode and have encountered the following error:
Undefined symbols for architecture x86_64:
"FlushRenderingCommands()", referenced from:
_CaptureScreenshot in Module.UETorch.cpp.o
InitCapture(UObject*, IntSize const*, FViewport**, APlayerController**, UWorld**, FSceneView**) in Module.UETorch.cpp.o
"FSlateApplication::CurrentApplication", referenced from:
_CaptureScreenshot in Module.UETorch.cpp.o
FSlateApplication::Get() in Module.UETorch.cpp.o
"FSlateApplication::TakeScreenshot(TSharedRef<SWidget, (ESPMode)0> const&, FIntRect const&, TArray<FColor, FDefaultAllocator>&, FIntVector&)", referenced from:
_CaptureScreenshot in Module.UETorch.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)
It seems like the ld: symbol(s) not found... part is often fixed by using libstdc++ instead of libc++ and I have tried adding -stdlib=libstdc++ to "Other Linker Flags" as well as linking libstdc++.6.0.9.dylib in the Build Phases section but I am still getting the same error.
I don't have the reputation to comment hence adding it here, you get undefined symbols when you try to use the symbol/Call the function and the linker can not find its definition. So if the definition is from some library then add it during your linking stage.
You can check if the definition is present or not in the library by using nm command, e.g. "nm -D"
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. :)