cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

varilsuhad
Adept I

Compilation under windows

Hi

I'm very new to opencl. I'm trying to compile c opencl code under windows 7 without Visual Studio. I always use console.

How can i compile using only console (cmd) under windows 7. Can i use icl? I already installed gcc.

My trials with gcc are failed. I have already installed AMD APP. Can you post exact command line?

Regards.

0 Likes
1 Solution
varilsuhad
Adept I

Sorry for late reply

I found the exact line for compilation it was very simple

gcc -I "C:\Program Files (x86)\AMD APP\include" hello.c "C:\Program Files (x86)\AMD APP\lib\x86\OpenCL.lib"

It is was the mixed platforms which caused this. gcc is x86 and i was trying to link x64 libraries. Interestingly omitting -lOpenCL dont do any harm.

View solution in original post

0 Likes
5 Replies
nou
Exemplar

you must set proper include and lib path. -IC:\path\to\SDK\include -LC:\path\to\lib -lOpenCL and it should work.

0 Likes
himanshu_gautam
Grandmaster

whar errors are you getting?

Try nou advice, that may solve the compilation issue. icl or gcc should be fine for compilation.

0 Likes
varilsuhad
Adept I

I'm trying to compile the most generic hello world code.

I'm using this line

gcc -I"C:\Program Files (x86)\AMD APP\include" -L"C:\Program Files (x86)\AMD APP\lib\x86_64" -lOpenCL hello.c

I checked these paths and files are there.

But i still get "undefined reference to clGetPlatformIDs" and other cl functions' errors.

Is it possible to pass -lOpenCL argument to icl?

0 Likes

Have you tried using the make files in windows. You can run them with -d option to check the exact command that needs to be executed.

0 Likes
varilsuhad
Adept I

Sorry for late reply

I found the exact line for compilation it was very simple

gcc -I "C:\Program Files (x86)\AMD APP\include" hello.c "C:\Program Files (x86)\AMD APP\lib\x86\OpenCL.lib"

It is was the mixed platforms which caused this. gcc is x86 and i was trying to link x64 libraries. Interestingly omitting -lOpenCL dont do any harm.

0 Likes