I am trying to compile a C++ program (that uses OpenCL functions) using Intel ICPC compiler: icpc mycode.cpp. I am getting the following error:
Undefined symbols for architecture x86_64:
"_clBuildProgram", referenced from:
_main in icpc4lnp65.o
..
..
"_clSetKernelArg", referenced from:
_main in icpc4lnp65.o
ld: symbol(s) not found for architecture x86_64
For g++ I saw that -framework OpenCL argument does the job of linking OpenCL libraries, but I am unable to figure out how to do the linking of OpenCL libraries using ICPC and there is not much documentation on using ICPC with OpenCL.
Related
I write a cross-platform audio processing program. It uses Qt 5 and PortAudio library. The platform is Mac OS X Yosemite, clang compiler, Qt Creator 3.4.1 IDE. I got those linker errors:
Undefined symbols for architecture x86_64:
"_ellie2", referenced from:
_main in eltst.o
"_hypergl", referenced from:
_main in ltstd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What does it mean and what needs to do?
Trying to compile my C++ application using clang which works but I get the following linker error:
Undefined symbols for architecture x86_64:
"_DADiskCopyDescription", referenced from:
Security::getHddID() in Security.cpp.o
"_DADiskCreateFromBSDName", referenced from:
Security::getHddID() in Security.cpp.o
"_DASessionCreate", referenced from:
Security::getHddID() in Security.cpp.o
ld: symbol(s) not found for architecture x86_64
I've checked the official documentation for Disk Arbitration on the Apple website but that's awful, since it doesn't even tell you which library file to include, let alone what to link to.
I'm using CMake to set up my build chain.
You need to use -framework DiskArbitration in your linker arguments.
I've written a C++ program on OS X 10.9, and I'd like to distribute the executable file, but the program won't run on OS X 10.7. I get the error message Illegal instruction: 4. Is there a way to compile my program on OS X 10.9 and have it work on previous versions of OS X, say 10.6 and greater? I'm not using Xcode, I'm using clang++ version 3.4 with OpenMP support (http://clang-omp.github.io). As a side note, I'd also like to distribute the OpenMP library with my program so that users don't have to install it themselves. How do I make the library work with older versions of OS X?
Note: When I use something like -mmacosx-version-min=10.6 during compilation I get several errors related to "Undefined symbols for architecture x86_64". For example, on this very simple program:
#include <iostream>
int main()
{
std::cout << "Hello, world!\n";
return 0;
}
Compiled as clang++ -o hello hello.cc -mmacosx-version-min=10.6, I get the following error:
Undefined symbols for architecture x86_64:
"__ZNKSt3__16locale9use_facetERNS0_2idE", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in hello-323147.o
"__ZNKSt3__18ios_base6getlocEv", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in hello-323147.o
"__ZNSt3__14coutE", referenced from:
_main in hello-323147.o
"__ZNSt3__15ctypeIcE2idE", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in hello-323147.o
"__ZNSt3__16localeD1Ev", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in hello-323147.o
"__ZNSt3__18ios_base33__set_badbit_and_consider_rethrowEv", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in hello-323147.o
__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5flushEv in hello-323147.o
"__ZNSt3__18ios_base5clearEj", referenced from:
__ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m in hello-323147.o
__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE6sentryD2Ev in hello-323147.o
__ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5flushEv in hello-323147.o
ld: symbol(s) not found for architecture x86_64
clang-3.4: error: linker command failed with exit code 1 (use -v to see invocation)
Based on the date of your question I guess this was some sort of bug in that specific clang version. I've tried compiling your example with Xcode 6.4 and it compiles and links fine:
$ clang++ -o hello hello.cc -mmacosx-version-min=10.6
$ ./hello
Hello, world!
$ clang++ -v
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix
Don't have an older osx machine to test it though, just ran it on Yosemite.
I'm implementing echoprint in my iOS 6 app but when I compile my project it gives me errors from Codegen.
Undefined symbols for architecture i386:
"Codegen::Codegen(float const*, unsigned int, int)", referenced from:
codegen_wrapper(float const*, int) in Codegen_wrapper.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to compile and run Codegen on iOS is explained here:
Echoprint iOS Missing Framework
Since simulator in XCode uses i386 processor, it fails to link it with object which is compiled in arm7.
While compiling libechoprint-codegen-ios.a choose iPhone Simulator as target, then you will have it compiled in i386. Then it will successfully link it. You can learn whether it is compiled in arm7 or i386 by typing
lipo -info path/libechoprint-codegen-ios.a
source: http://www.verious.com/qa/linker-error-for-echoprint-in-ios/
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. :)