I found that can add external library in the kernel, but need add path of library to cpp code. Can someone tell me, how to add clCreateProgramWithSource() in C++ with path of library?
Thats part of my code
Program::Sources source(1, std::make_pair(sourceCode.c_str(), sourceCode.length() + 1));
// Make program of the source code in the context
Program program = Program(context, source);
// Build program for these specific devices
errcode = program.build(devices);
if (errcode != CL_SUCCESS)
cout << "There were error during build kernel code. Please, check program code. Errcode = " << errcode << "\n";
cout << "BUILD LOG: " + program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(devices) + "\n";
// Make kernel
Kernel kernel(program, "vector_add");
1 of 1 people found this helpful
Use clLinkProgram to link a set of compiled program objects and libraries to your kernel program. For that, first compile your source code using clCompileProgram and generate the compiled objects. Then link the compile objects and other libraries to create final executable.