I\'m currently learning OpenCL. Now, when I want to compile my program, I get an error with this command:
g++ -Wall -l OpenCL main.cpp -o main
Order of [most] arguments to g++
is very important.
Libraries should go last (at least after source and object files). You can't really change that.
The -l
should preferably be glued to the library name:
g++ -Wall main.cpp -o main -lOpenCL
# ^^^ glue the -l to the library name
You probably want to also pass -g
(in addition of -Wall
) to the compiler to get a debuggable binary. Use the gdb
debugger.
As James Kanze commented, you might want to replace -g
with -ggdb
if using specifically gdb
.