Results 1 to 2 of 2

Thread: add header file using clCreateProgramWithSource

  1. #1
    Junior Member
    Join Date
    Mar 2010

    add header file using clCreateProgramWithSource


    I added a header file to my program using clCreateProgramWithSource,
    because I had errors that the code doesn't recognize variables defined in the .h file
    this is my code:
    Code :
    const char* files[2];
    size_t include_length;
    const char* include_path = "C:/Users/localcontrol/Desktop/work/nvidia3.0/cv.h";
    char *cvinclude = oclLoadProgSource(include_path, "", &include_length);
    printf( "cv path %s\n", include_path);
    //printf( "%s\n", cvinclude);
    printf( "include_length %d\n", include_length);
    shrCheckErrorEX(cvinclude != NULL, shrTRUE, pCleanup);
    size_t program_length;
    const char* source_path = shrFindFilePath(clSourcefile, argv[0]);
    char *source = oclLoadProgSource(source_path, "", &program_length);
    printf( "cl path %s\n", source_path);
    //printf( "%s\n", source);
    printf( "program_length %d\n", program_length);
    shrCheckErrorEX(source != NULL, shrTRUE, pCleanup);
    files[0] = cvinclude;
    files[1] = source;
    size_t lenghts[2];
    lenghts[0] = include_length;
    lenghts[1] = program_length;
    printf( "%s\n", files[0]);
    printf( "%s\n", files[1]);
    // create the program
    cpProgram = clCreateProgramWithSource(cxGPUContext, 2, (const char **) &files, (const size_t *) lenghts, &ciErrNum);
    oclCheckErrorEX(ciErrNum, CL_SUCCESS, pCleanup);
    // build the program
    ciErrNum = clBuildProgram(cpProgram, 0, NULL, "-cl-mad-enable", NULL, NULL);
    but it doesn,t build my program,
    I get Error # 1 at file .c

    can anyone see if I made mistakes in my code
    Help please.

  2. #2
    Senior Member
    Join Date
    Jul 2009
    Northern Europe

    Re: add header file using clCreateProgramWithSource

    There have been several people reporting problems with Nvidia drivers and loading header files. Try pasting your header file code directly into the file you send to clCreateProgram and see if it works.

Similar Threads

  1. clCreateProgramWithSource - could be a file?
    By valhalla in forum OpenCL
    Replies: 3
    Last Post: 04-13-2013, 08:51 AM
  2. How to add header?
    By dave88 in forum OpenCL
    Replies: 4
    Last Post: 04-20-2010, 05:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean