MrWolvwxyz
MrWolvwxyz

Reputation: 93

OpenCL header file difficulty

So I am trying to set up a way to easily develop OpenCL programs which turned out to be the hardest part of learning this language so far. I include CL/cl.h in my source files but I keep getting compiler errors that the headers don't exist. When I change the include to only be cl.h it works but every program I have seen so far uses CL/cl.h so I am assuming it is some sort of macro to allow either file. Any ideas how I can get around this or possible fixes?

This is my makefile

PROJ=ocl_intro

CC=mingw32-g++

CFLAGS=-std=c99 -Wall

LIB=-lOpenCL

ifdef INTELOCLSDKROOT

INC_DIRS="$(INTELOCLSDKROOT)include\CL"

LIB_DIRS="$(INTELOCLSDKROOT)lib\x86

endif

$(PROJ): $(PROJ).cpp

$(CC) $(CFLAGS) -o $@ $^ -I$(INC_DIRS) -L$(LIB_DIRS) $(LIB)

.PHONY: clean

clean:

rm $(PROJ).exe

Upvotes: 1

Views: 1575

Answers (1)

Thomas
Thomas

Reputation: 3381

Change:

INC_DIRS="$(INTELOCLSDKROOT)include\CL"

To:

INC_DIRS="$(INTELOCLSDKROOT)include"

You are looking for "CL/cl.h", obviously it's not going to find a folder called "CL" inside "include\CL", since you're already giving the "CL" folder as a search path. As is now, you're essentially asking the compiler to find "\include\CL\CL\cl.h", clearly the compiler will fail since this file does not exist.

You are meant to simply provide the path to the "include" folder - conventions will do the rest.

Upvotes: 1

Related Questions