ofParameter.h compile error

Hi there,

I’m trying to compile the examples of ofxOpenNI and ofxNI2, none of them work due to the same error from this part of ofParameter.h

template <class T> yes check(T const&);
no check(no);

template <typename T>
struct has_loading_support {
    static istream & stream;
    static T & x;
    static const bool value = sizeof(check(stream >> x)) == sizeof(yes);
};

template <typename T>
struct has_saving_support {
    static ostream & stream;
    static T & x;
    static const bool value = sizeof(check(stream << x)) == sizeof(yes);
};

Where I get this:

    ../../../libs/openFrameworks/types/ofParameter.h:327:21: warning: declaration does not declare anything [-Wmissing-declarations]
        template <class T> yes check(T const&);
                           ^~~
../../../libs/openFrameworks/types/ofParameter.h:328:2: warning: declaration does not declare anything [-Wmissing-declarations]
        no check(no);
        ^~
../../../libs/openFrameworks/types/ofParameter.h:334:57: error: expected expression
            static const bool value = sizeof(check(stream >> x)) == sizeof(char);
                                                               ^
../../../libs/openFrameworks/types/ofParameter.h:341:57: error: expected expression
            static const bool value = sizeof(check(stream << x)) == sizeof(char);

This is driving me nuts, makes me wonder why have I accepted yet another Kinect project (I guess it still impresses a lot of people out there)

I’m on OS X 10.10.5
OF from master branch
XCode 7.1, also fails with 6.3.2

1 Like

Same here, did you find a solution?

this is my setip:
of 0.9.0
osx 10.9.5
xcode 4.6.3
latest command line tools

have you recreated the project files with the project generator? th eproject files that come with openni might be outdated and won’t have support for c++11 which is reqiured for that part of ofParameter

1 Like

You’re right,

I just created a new project using the generator, imported all my sources files, everything is ok now.

Thanks!

Hmm, in my case, i have create a new project with the last Generator, edit my project (replace main.cpp), but i have the same issue…

Mac 10.11 - Xcode 7.2 - of090

Any help or manual update ?

Generating a new project works, but I still would like to know what’s changed on the XCode project to cause this fail.

have you recreated the project files with the project generator? th eproject files that come with openni might be outdated and won’t have support for c++11 which is reqiured for that part of ofParameter

It worked for me! Thanks @arturo!

For ofParameter.h, I got several errors "Parse issue: expected expression”. Recreating the project with the Project Generator solved the problem.

By the way: the source files of my project were testApp.h and testApp.cpp but, instead, the project generator created references to ofApp.h and ofApp.cpp, so I had to delete these references (Xcode sidebar, src folder, marked in red) in order to compile correctly .

OS X 10.10.3 - XCode 6.4 - oF 0.9.8