windows - Error in compilation : undefined reference to 'clGetPlatformInfo@20' -


i'm such newby concerning opencl programming, , want run simple program in "opencl parallel programming development cookbook". in fact, want query opencl platforms simple prog:

#include <stdio.h> #include <stdlib.h> #include <cl/cl.h>  void displayplatforminfo(cl_platform_id id,                      cl_platform_info param_name,                      const char* paramnameasstr) {     cl_int error = 0;     size_t paramsize = 0;     error = clgetplatforminfo( id, param_name, 0, null, &paramsize );     char* moreinfo = (char*)malloc( sizeof(char) * paramsize);     error = clgetplatforminfo( id, param_name, paramsize,moreinfo, null );     if (error != cl_success ) {         perror("unable find opencl platform information");            return;     }     printf("%s: %s\n", paramnameasstr, moreinfo); } int main() {     /* opencl 1.2 data structures */     cl_platform_id* platforms;     /* opencl 1.1 scalar data types */     cl_uint numofplatforms;     cl_int error;     /* number of platforms remember each vendor's sdk installed on computer, number of available platform */     error = clgetplatformids(0, null, &numofplatforms);     if(error < 0) {         perror("unable find opencl platforms");         exit(1);     }     // allocate memory number of installed platforms.     // alloca(...) occupies stack space     // automatically freed on return     platforms = (cl_platform_id*) malloc(sizeof(cl_platform_id)                                      * numofplatforms);     printf("number of opencl platforms found: %d\n",        numofplatforms);     // invoke api 'clplatforminfo' twice each     // parameter we're trying extract     // , use return value create temporary data     // structures (on stack) store     // returned information on second invocation.     for(cl_uint = 0; < numofplatforms; ++i) {         displayplatforminfo( platforms[i],                          cl_platform_profile,                          "cl_platform_profile" );         displayplatforminfo( platforms[i],                          cl_platform_version,                          "cl_platform_version" );         displayplatforminfo( platforms[i],                          cl_platform_name,                          "cl_platform_name" );         displayplatforminfo( platforms[i],                          cl_platform_vendor,                          "cl_platform_vendor" );         displayplatforminfo( platforms[i],                          cl_platform_extensions,                          "cl_platform_extensions" );     }     return 0; } 

i'm on qt creator, , pc's config concerning video : nvidia geforce gt 635m & intel(r) hd graphics 4000 under windows 8.1

my .pro file :

sources += \     main.cpp  qmake_cxxflags += -std=c++0x  includepath += \     $$quote(c:/program files/nvidia gpu computing toolkit/cuda/v6.5/include)  libs += \     $$quote(c:/program files/nvidia gpu computing toolkit/cuda/v6.5/lib/x64/opencl.lib) 

because of spaces in file path. so, question : why, when i'm compiling project, problem "undefined reference clgetplatforminfo@20'" appear? there's 2 others errors (one same, other "undefined reference toclgetplatformids@12'")

i search on web lot of days , can't find answer (these prob has answer on linux or on mac..)

thanks in advance !

mathieu

it looks trying build 32-bit application, while linking 64-bit version of opencl.lib:

c:/program files/nvidia gpu computing toolkit/cuda/v6.5/lib/x64/opencl.lib

so, either build application in 64-bit mode, or fix path point 32-bit version of opencl.lib.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -