Results 1 to 3 of 3

Thread: 'y' is not a member of cl_float2

  1. #1

    'y' is not a member of cl_float2

    Hi,

    I'm having a compiling issue.

    cl_float2 p;
    p.x = 1.0;
    p.y = 1.0;

    reports the error:

    'x' is not a member of cl_float2
    'y' is not a member of cl_float2

    The same happens with cl_float4, but

    p.s[0]=1.0; and p.s[1]=1.0; works fine.

    Looking at cl_platform.h:

    Code :
    typedef union
    {
    cl_float  CL_ALIGNED(8) s[2];
    #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
       __extension__ struct{ cl_float  x, y; };
       __extension__ struct{ cl_float  s0, s1; };
       __extension__ struct{ cl_float  lo, hi; };
    #endif
    #if defined( __CL_FLOAT2__) 
        __cl_float2     v2;
    #endif
    }cl_float2;

    the extensions are not defined. I mean, __GNUC__ and __STRICT_ANSI__ are not defined so it just define s[2]. Anyone knows how to solve it?

    I'm working on windows 7 x64, visual studio 2008, NVIDIA CUDA SDK 3.2. The projects is compiled and linked in win32 not x64.

    Any help will be apreciated. Thanks

  2. #2
    Member
    Join Date
    Mar 2010
    Location
    Raleigh, NC
    Posts
    55

    Re: 'y' is not a member of cl_float2

    You're about the 5th or 6th person I've seen with this complaint (I being one of the others). As a workaround (since I know my code is never going to run outside of my machine), I've gotten rid of the if() definitions to make it work on Visual Studio.

  3. #3

    Re: 'y' is not a member of cl_float2

    Quote Originally Posted by HolyGeneralK
    I've gotten rid of the if() definitions to make it work on Visual Studio.
    I finally opt by another solution. I do MakeFile projects with visual studio and I compile with the gcc compiler via cygwin. This way __GNUC__ variable is defined and the compiler launches no error.

    Anyway, your solution is faster and easier.

Similar Threads

  1. Replies: 5
    Last Post: 10-25-2009, 02:40 PM

Posting Permissions

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