when you are linking, the order of your libraries and source files makes a difference. for example for your case,
g++ -I/usr/local/cuda/include -L/usr/lib/nvidia-current -lOpenCL opencl.cpp
functions defined in the OpenCL library might not be loaded, since there nothing before them asking for a look-up. however if you use,
g++ opencl.cpp -I/usr/local/cuda/include -L/usr/lib/nvidia-current -lOpenCL
then any requests for functions will be found in the OpenCL library and they will be loaded.
Related Contents:
- Static variables initialisation order
- How to properly add include directories with CMake
- Splitting templated C++ classes into .hpp/.cpp files–is it possible?
- How do I make a fully statically linked .exe with Visual Studio Express 2005?
- What happens to global and static variables in a shared library when it is dynamically linked?
- Linking static libraries to other static libraries
- g++ undefined reference to typeinfo
- How does C++ linking work in practice? [duplicate]
- GCC C++ Linker errors: Undefined reference to ‘vtable for XXX’, Undefined reference to ‘ClassName::ClassName()’
- VS Code will not build c++ programs with multiple .ccp source files
- What do linkers do?
- Is it safe to link C++17, C++14, and C++11 objects
- error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
- Altering DLL search path for static linked DLL
- Undefined reference to ‘pthread_create’ — linker command option order (libraries before/after object files?) [duplicate]
- How can I statically link standard library to my C++ program?
- g++ linking order dependency when linking c code to c++ code
- How do I install the OpenSSL libraries on Ubuntu?
- C and C++ programming on Ubuntu 11.10 [closed]
- Difference between shared objects (.so), static libraries (.a), and DLL’s (.so)?
- How to specify preference of library path?
- static variables in an inlined function
- C++ template, linking error [duplicate]
- Compiling multithread code with g++
- Linking a shared library with another shared lib in linux
- Compilation fails with “relocation R_X86_64_32 against `.rodata.str1.8′ can not be used when making a shared object”
- gcc: undefined reference to
- error LNK2005: already defined – C++
- How to create NVIDIA OpenCL project
- MinGW linker error: winsock
- openCV program compile error “libopencv_core.so.2.4: cannot open shared object file: No such file or directory” in ubuntu 12.04
- Undefined reference error for template method [duplicate]
- GCC linker can’t find standard library?
- Replacing ld with gold – any experience?
- questions about name mangling in C++
- error LNK2038: mismatch detected for ‘_ITERATOR_DEBUG_LEVEL’: value ‘0’ doesn’t match value ‘2’ in main.obj
- What do C and Assembler actually compile to? [closed]
- Visual Studio Code formatting for “{ }”
- How to link using GCC without -l nor hardcoding path for a library that does not follow the libNAME.so naming convention?
- Unresolved external symbol LNK2019
- cmake find_package specify path
- When should I write the keyword ‘static’ before a non-member function?
- How to use OpenSSL with GCC?
- Why is statically linking glibc discouraged?
- error LNK2005: xxx already defined in MSVCRT.lib(MSVCR100.dll) C:\something\LIBCMT.lib(setlocal.obj)
- Can I link a plain file into my executable? [duplicate]
- How does the linker handle identical template instantiations across translation units?
- Undefined reference to `stdscr’ while using ncurses
- How to solve ——-undefined reference to `__chkstk_ms’——-on mingw
- Multiple definition error on variable that is declared and defined in header file and used only in its cpp file