PDA

View Full Version : #include problems in Apple's implementation



patekd
10-27-2009, 01:11 AM
I'm using the preprocessor macro #include in an OpenCL file.
However, the compiler tells me that it cannot find the file during compile.
Does anyone know if it is specified where the compiler should go looking for included files?

The default behavior would be preferred, s.t. if I use
#include "file"
with quotes, it searches the same directory as the source file I'm compiling.
Now I have no clue where it tries to locate the file....
Any ideas?

I'm using
xcode 3.2.1 on snow leopard(obviously)

Regards
/Patrik

dbs2
10-28-2009, 12:48 AM
I've had problems with this in the past where it looks for the file in the same directory as the executable, but when you're building with Xcode it usually puts that in a "debug" folder somewhere other than where your source code is located. Try copying the file you want to include to the same directory as the binary or changing the working directory for the executable and see if that helps. If it does you can add a copy phase to your build in Xcode to copy the file into the appropriate directory. If it doesn't, then I'm not sure where it is looking. You can always use fs_usage to monitor the process and see what it's trying to open.

patekd
10-28-2009, 01:03 AM
Thanks for your reply dbs2.
I have tried both having the file in the source directory and having it copied to the executable directory, where the run-time looks for the .cl file to compile(as you proposed). Neither work.
I might have to do some spying with fs_usage then...

/patekd

dbs2
10-28-2009, 07:49 AM
The only other thing I can think of is to make sure that you aren't having issues with a case-sensitive/insensitive filesystem. I believe OS X is by default case insensitive, but that can cause problems. (e.g., #include "OpenCL.h" vs. #include "opencl.h")