Wednesday, 15 February 2012

Android Studio fatal error: CL/cl.h No such file or directory -


I am trying to create an OpenCL program in Android Studio and running in the following problem:

< Pre> Android Studio Fatal Error: CL / CLP is not such a file or directory

I am searching and everything is a solution for "Visual Studio".

I thought that if we have the solution specifically listed for Android studio and this error, then it can be helpful.

Any ideas how to fix this? I think that the reference commands from the command line to the GCC move I just have to work with Android Studio

OpenCL is not part of Android, so you can not get a CLH. Download the required cl header files from here:

Download CLH with the correct version (as the CL version is using, for example, CL 1.1).

Header files in your OpenCL program, so you have good to go.


Edited 4/18/2015:

OpenCL header files, you can do the following:

  #ifdef __APPLE__ #include & lt; OpenCL / opencl.h & gt; #else #include & lt; CL / opencl.h & gt; #endif  

But if you have the program CR code (without CL-GL interoperability), CL / CLH also includes:

  #include & Lt; CL / cl.h & gt;  

After doing this, you should add folders containing the cl folders in the path in your mailbox. (Below is the PATH_TO_CL_FOLDER your CL folder)

For people using Android .mk

If you have application.mk and Android Working with MK, and using your native library traditional ndk-build , you should add the path to the CL directory in the LOCAL_C_INCLUDES variable in Android.mk.

<<> LOCAL_C_INCLUDES + = PATH_TO_CL_FOLDER

For people who work with griddle in Android studio (This is what you need )

Edit Build.gradle, add your path to the cFlags field as listed below:

  android {defaultConfig {ndk {moduleName "yourlib" stl "stlport_static "LdLibs" logs "," z "cflags" -IPATH_TO_CL_FOLDER "} ...} ...}  

No comments:

Post a Comment