Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6784441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:59:43+00:00 2026-05-26T16:59:43+00:00

I am trying to run an OpenCL C++ sample on Eclipse CTD that (on

  • 0

I am trying to run an OpenCL C++ sample on Eclipse CTD that (on Mac) includes the OpenCL header as follows:

#include <OpenCL/cl.h>

The file exists on my system (OpenCL sdk is installed by default on Mac) but not in a OpenCL directory (actual path: /System/Library/Frameworks/OpenCL.framework/Versions/A/Headers), so if I add that path as an included directory in the properties of the project and remove the relative OpenCL directory from the #include statement the linking is obviously resolved but I notice that in that cl.h file other header files are referenced with the same relative path (ex. OpenCL/cl_platform.h) but you can see from the path above this OpenCL directory does not actually exist so I am wondering how this thing is supposed to work in the first place.

My question:

In my example above, is the ‘OpenCL’ directory in the relative path supposed to exist physically somewhere or is it supposed to be some kind of environment variable or similar that points to the actual path the sdk is installed in?

Sorry for the confusion, any help appreciated!

Note: from this article on the khronos website it seems that the OpenCL directory is supposed to physically exist.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:59:43+00:00Added an answer on May 26, 2026 at 4:59 pm

    I recommend you read Apple’s documentation on Frameworks.

    The basic story, however, is that OS X resolves library and header search paths based on the frameworks you compile against. For example, to compile a program using the OpenCL SDK on a Macintosh, you’d compile like this:

    clang -framework OpenCL main.c
    

    This tells clang (or gcc, or llvm-gcc, depending on your choice of compiler) to search the System OpenCL SDK for both headers (for compilation) and libraries (for linking). Give it a try:

    // compile me with: clang -framework OpenCL -o test test.c
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <OpenCL/opencl.h>
    
    int main(int argc, char* const argv[]) {
        cl_uint num_devices, i;
        clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, 0, NULL, &num_devices);
    
        cl_device_id* devices = calloc(sizeof(cl_device_id), num_devices);
        clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, num_devices, devices, NULL);
    
        char buf[128];
        for (i = 0; i < num_devices; i++) {
            clGetDeviceInfo(devices[i], CL_DEVICE_NAME, 128, buf, NULL);
            fprintf(stdout, "Device %s supports ", buf);
    
            clGetDeviceInfo(devices[i], CL_DEVICE_VERSION, 128, buf, NULL);
            fprintf(stdout, "%s\n", buf);
        }
    
        free(devices);
    }
    

    Note that I’ve include OpenCL/opencl.h here. This is the preferred header to include to get access to CL on the Mac. If you look at the header, you will see that it includes cl.h for you, as well as cl_platform.h. You can just include OpenCL/cl.h if you’d like; it will still work fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying run a program from a qmake .pro file which modifies the
When trying to run an Eclipse Dynamic Web Project under a Tomcat setup using
I'm trying to run a batch file, as another user, from my web app.
I'm trying to run a LINQ to SQL query that returns a result in
I'm trying to run NVidia's OpenCL demo oclNbody.exe on ATI Radeo 4850 card and
(Step 1) I'm trying to get openCV to run from python on my mac
I'm trying to compile and run a Java3D project on my mac and having
I'm trying to run ORTS on my Mac for a school project. It was
Situation: I'm trying run an https store (xcart) under one domain secure.example.com and I
Trying to run the following command in php to run powershell command... the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.