vendredi 2 juin 2017

Cannot use -std=c++11 and -l/-L options at the same time in Eclipse Neon.3

I am trying to work through this tutorial on OpenCL, on a Windows 10 dev system which has integrated Intel HD graphics. I have installed Intel's OpenCL SDK and I have set up the linker in eclipse to point to opencl.lib as outlined in this answer, and I have added the include directory from the SDK install into Properties > C/C++ General > Paths and Symbols > Includes. I am using MinGW as my compiler for Eclipse

There's an offending line from the tutorial which maes it impossible for the tutorial boiler-plate to compile:

87 cl_int result = program.build({ device }, "");

Set up as I am, this gives me the following warning and error:

..\src\main.cpp:93:32: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
..\src\main.cpp:93:45: error: no matching function for call to 'cl::Program::build(<brace-enclosed initializer list>, const char [1])'

If I'm reading this correctly (I haven't used C++ since before C++11 was a thing), the compiler is first warning me that it doesn't properly recognize what {device} is supposed to be (a vector of devices which has only one entry in it, initialized earlier in the code). Then, since it doesn't recognize {device}, the compiler errors out because it can't find a signature for cl::Program::build with arguments that match whatever-the-heck it's interpreting {device} to be.

Following the warning's advice, I followed the instructions given in this answer to add the -std=c++11 option for the compiler. However, when I do that it breaks the linker. Trying to compile with these options results in about thirty errors which all basically say they can't find any reference for the CL calls in the library files. For example:

C:/Program Files (x86)/Intel/OpenCL SDK/6.3/include/CL/cl.hpp:1753: undefined reference to `clGetPlatformInfo@20'

How do I make the compiler behave?

Aucun commentaire:

Enregistrer un commentaire