An alternative answer to JohnIdol's question. In particular, an approach that may work if you do not want to change the <OpenCL/cl.h> link to <cl.h>
Firstly, I came to the site with this very question (how to incorporate Apple infrastructure in Eclipse CDT (C / C ++) projects), and I really appreciate the discussion - it gave me a starting point.
John's answer is cool, but it has to do with changing how the called file is called (for example, <OpenCL/cl.h> becomes <cl.h> in the code). He then makes a link to the direct path in the eclipse properties for each Header directory that he needs.
In my case, I checked the GNU Backgammon to play around with the source code. This code compiles (with some mods in LDFLAGS and CPPFLAGS before executing autogen.sh ) in the OS X CLI using the standard Apple I-guess approach of the -framework standard and with file links included, such as #include <CoreAudio/CoreAudioTypes.h>
I may never do anything, but I didn’t want to start hacking #includes in code that already compiles just fine using the standard approach. So I did the following:
- Created a new directory in my gnubg workspace called "Frameworks".
Inside this directory, create soft links for the header directories.
ln -s /System/Library/Frameworks/CoreAudio.framework/Headers CoreAudio
In the project properties gnubg> C / C ++ General> Paths and symbols added /gnubg/Frameworks to Include directories (as the path to the workspace). I only had to do this once, regardless of the number of soft links I made.
Thus, I did not have to change the code at all, Eclipse was happy, the CLI compilation was also happy.
I note that there is a slight wrinkle if you use some directories in Frameworks, such as CoreServices.framework . In these cases, other included files (for example, .. ) have a Frameworks subdirectory and relative path links in some included files. Therefore, in this case, I had to slightly change the procedure. Basically, I had to add an additional subdirectory to Frameworks for CoreServices.framework , and then in this directory I had to add two soft links. One for CoreServices (for headers) and one for the Framework subdirectory.
lrwxr-xr-x 1 dhansen staff 57B Jul 27 02:06 CoreServices -> /System/Library/Frameworks/CoreServices.framework/Headers lrwxr-xr-x 1 dhansen staff 60B Jul 27 02:05 Frameworks -> /System/Library/Frameworks/CoreServices.framework/Frameworks
Then I had to add /gnubg/Frameworks/CoreServices.framework to the inclusion path (step 3 above).
And so it is. No more file problems.
danhan
source share