cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

sky3551211
Journeyman III

Problem:Unable to pass structure to a opencl kernel

main.h

typedef struct _Point

{

  unsigned int x;

  unsigned int y;

}mPoint;

kernel.cl:


#include"main.h"


__kernel void Fun(__global struct mPoint* p)

{                              

    unsigned int tid = get_local_id(0);

    p->x=tid;

}

The error returned by clBuildProgram():

clBuild failed:-11

Compilation started

1:3:38: warning: declaration of 'struct mPoint' will not be visible outside of t

his function

1:6:3: error: incomplete definition of type 'struct mPoint'

1:3:38: note: forward declaration of 'struct mPoint'

Compilation failed

I don't known where is the mistake.

Thanks.

0 Likes
1 Solution
dipak
Big Boss

Modify as shown below and try:

__kernel void Fun(__global struct mPoint* p) or __kernel void Fun(__global mPoint* p)

Regards,

View solution in original post

0 Likes
1 Reply
dipak
Big Boss

Modify as shown below and try:

__kernel void Fun(__global struct mPoint* p) or __kernel void Fun(__global mPoint* p)

Regards,

0 Likes