I'm getting a linker error from the OpenCL 2.0 C++ bindings header file cl2.hpp. All my headers files come directly from the Khronos OpenCL registry and I build the OpenCL.lib file myself. I don't get an error using the OpenCL 1.2 C++ bindings header file.
I am using Qt 5.5.0 and Visual Studio C++ 2013 with Windows7 64-bit.
The error is related to multiply defined symbols in multiple source files.
mainwindow.cpp.obj:-1: error: LNK2005: "enum cl::QueueProperties __cdecl
cl::operator|(enum cl::QueueProperties,enum cl::QueueProperties)"
(??Ucl@@YA?AW4QueueProperties@0@W410@0@Z) already defined in main.cpp.obj
I don't understand why the compiler is saying this is already defined.
I have narrowed down the problem to this code in the cl2.hpp file
QueueProperties operator|(QueueProperties lhs, QueueProperties rhs)
{
return static_cast<QueueProperties>(static_cast<cl_command_queue_properties>(lhs) | static_cast<cl_command_queue_properties>(rhs));
}
When I comment that code out my project compiles and runs fine. Do you have any clue to what this problem is? Is it a poor design in the cl2.hpp header file?