Results 1 to 6 of 6

Thread: error in OpenCL

Hybrid View

  1. #1
    Newbie
    Join Date
    Nov 2013
    Posts
    3

    error in OpenCL

    Hello.
    I downloaded OpenCL from the page official of AMD ( I have installed AMD-APP-SDK-v2.9-lnx32.tgz).

    The installation was successful but when compiling a program I get the following error:

    'size_t' was not declared In this scope


    This error is repeated with other variables.

    How I can fix? I have to install something else?

    Thanks.

  2. #2
    Newbie
    Join Date
    Sep 2013
    Posts
    5
    Hi,

    I don't think size_t should have anything to do with OpenCL itself. Could you post the code you are trying to compile?

    To my knowledge size_t is in the std library so it should be included if it isn't already.

  3. #3
    Newbie
    Join Date
    Nov 2013
    Posts
    3
    This is my code:

    #include "simpleCL.h"

    int main() {
    char buf[]="Hello, World!";
    size_t global_size[2], local_size[2];
    int found, worksize;
    sclHard hardware;
    sclSoft software;

    // Target buffer just so we show we got the data from OpenCL
    worksize = strlen(buf);
    char buf2[worksize];
    buf2[0]='?';
    buf2[worksize]=0;

    // Get the hardware
    hardware = sclGetGPUHardware( 0, &found );
    // Get the software
    software = sclGetCLSoftware( "example.cl", "example", hardware );
    // Set NDRange dimensions
    global_size[0] = strlen(buf); global_size[1] = 1;
    local_size[0] = global_size[0]; local_size[1] = 1;

    sclManageArgsLaunchKernel( hardware, software, global_size, local_size,
    " %r %w ",
    worksize, buf, worksize, buf2 );

    // Finally, output out happy message.
    puts(buf2);

    }

    __kernel void example( __global char* buf, __global char* buf2 ){
    int x = get_global_id(0);

    buf2[x] = buf[x];

    }

    Thanks!
    Last edited by MariaCS; 11-18-2013 at 08:03 AM.

  4. #4
    Newbie
    Join Date
    Sep 2013
    Posts
    5
    Try to include stdlib.h aswell. I think this will make the size_t definition available.


    #include <stdlib.h>

  5. #5
    Newbie
    Join Date
    Nov 2013
    Posts
    3
    This is the output now:

    simple.cpp:1:22: error: simpleCL.h: No such file or directory
    simple.cpp: In function ‘int main()’:
    simple.cpp:8: error: ‘sclHard’ was not declared in this scope
    simple.cpp:8: error: expected ‘;’ before ‘hardware’
    simple.cpp:9: error: ‘sclSoft’ was not declared in this scope
    simple.cpp:9: error: expected ‘;’ before ‘software’
    simple.cpp:12: error: ‘strlen’ was not declared in this scope
    simple.cpp:18: error: ‘hardware’ was not declared in this scope
    simple.cpp:18: error: ‘sclGetGPUHardware’ was not declared in this scope
    simple.cpp:20: error: ‘software’ was not declared in this scope
    simple.cpp:20: error: ‘sclGetCLSoftware’ was not declared in this scope
    simple.cpp:27: error: ‘sclManageArgsLaunchKernel’ was not declared in this scope
    simple.cpp:30: error: ‘puts’ was not declared in this scope
    simple.cpp: At global scope:
    simple.cpp:34: error: expected constructor, destructor, or type conversion before ‘void’


    Thanks!!

  6. #6
    Senior Member
    Join Date
    Oct 2012
    Posts
    166
    he cant find simpleCL.h
    Thats why all the rest went wrong. have you set your include path correctly?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •