Pergunta

I am trying to compile my OpenCL app with the following command in mingw32 : mingw32-gcc -o plat plat.c

but i recieve this error : CL/cl.h no such file or directory

I searched many times all over the net and this site but can't find any good answer. I did every work but it still makes error. I use AMD Radeon HD 5470 and have installed the latest catalyst Driver and AMD APP SDK 2.8 on win 7 I have installed VS 2012

in my code I use several states with hope to work but .... it still makes the same error

I also used -I & -L in compile command and it still makes error : CL/cl.h no such file or directory

how ever I don't know how could use make file to compile the code

I 'll be so thankful any one whom help me : mehdioraki59@yahoo.com

My system is : dell studio 1558

this is my very very simple testing code :

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifdef MAC
#include <OpenCL/cl.h>
#else
#include <C:\Program Files (x86)\AMD APP\include\CL\cl.hpp>
//#include <CL/cl.h>    >>>>>>>  i manually disabled this line but there is still error
#endif
int main() {
cl_platform_id             *platforms;
cl_uint                    num_platforms;
cl_int                     i, err, platform_index = -1;
char*                      ext_data;
size_t                     ext_size;
err = clGetPlatformIDs(1, NULL, &num_platforms);
if(err < 0) {
perror("Couldn't find any platforms.");
exit(1);
}
free(platforms);
return 0;
}
Foi útil?

Solução 2

I finally found the answer also thank you mr chippies : how ever your advise helped me more i used this make file : PROJ=qwerty_mehdi CC=mingw32-gcc CFLAGS=-Wall LIB=-lOpenCL ifdef AMDAPPSDKROOT INC_DIRS="$(AMDAPPSDKROOT)include" LIB_DIRS="$(AMDAPPSDKROOT)lib\x86" else ifdef NVSDKCOMPUTE_ROOT INC_DIRS="$(NVSDKCOMPUTE_ROOT)\OpenCL\common\inc" LIB_DIRS="$(NVSDKCOMPUTE_ROOT)\OpenCL\common\lib\Win32" endif endif $(PROJ): qwerty.c $(CC) $(CFLAGS) -o $@ $^ -I$(INC_DIRS) -L$(LIB_DIRS) $(LIB)

and also deleted this line : #include

and after this the .exe was made successfully

in the lines of make file code the qwerty.c is the codes i explained before .

Outras dicas

You need to add -I"C:\Program Files (x86)\AMD APP\include" to your build command to tell mingw32-gcc where to find CL/cl.h. Using this, the line #include should work properly.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top