zkmkarlsruhe / ofxTensorFlow2

TensorFlow 2 AI/ML library wrapper for openFrameworks
Other
113 stars 17 forks source link

Error compiling: No member named 'exchange' in namespace 'std' #19

Closed Dazzid closed 2 years ago

Dazzid commented 2 years ago

I'm trying to compile in MacOsX example_basic, but I'm having this error: No member named 'exchange' in namespace 'std', in context.h line 78.

inline context::context(context&& ctx) noexcept : tfe_context(std::exchange(ctx.tfe_context, nullptr)) { } inline context& context::operator=(context&& ctx) noexcept { tfe_context = std::exchange(ctx.tfe_context, tfe_context); return *this; }

I might be missing a step of the installation?

bytosaur commented 2 years ago

hey @Dazzid, so std::exchange is a feature from C++14. Looks like your compiling for some older version. When I remember correctly we set the flag for C++17 at some point. How are you compiling this?

danomatika commented 2 years ago

We currently require C++14 for the addon.

I might be missing a step of the installation?

Did you catch the manual change that is required to force this in OF on macOS?

Dazzid commented 2 years ago

OK, I changed to C++14. Also updated the CLANG_CXX_LANGUAGE_STANDARD[arch=x86_64] = c++14 before running project generator. Now I have new errors. Maybe because I'm using an M1?

/Users/david/libs/openFrameworks/events/ofEvent.h:204:40: a space is required between consecutive right angle brackets (use '> >') /Users/david/libs/openFrameworks/events/ofEvent.h:220:25: function definition does not declare parameters /Users/david/libs/openFrameworks/events/ofEvent.h:153:4: use of undeclared identifier 'self' /Users/david/libs/openFrameworks/events/ofEvent.h:161:33: use of undeclared identifier 'self' /Users/david/libs/openFrameworks/events/ofEvent.h:162:4: use of undeclared identifier 'self' /Users/david/libs/openFrameworks/events/ofEvent.h:163:4: use of undeclared identifier 'self'

danomatika commented 2 years ago

Maybe because I'm using an M1?

No. The error is a compile-time error, not a linker error where architecture comes into play.

What version of OF are you using?

Dazzid commented 2 years ago

I'm using of_v0.11.2, and that's right, the error appears when I change to c++14.

danomatika commented 2 years ago

I'm using of_v0.11.2, and that's right, the error appears when I change to c++14.

Do you do a full project clean before rebuilding after changing anything within the build system?

Dazzid commented 2 years ago

yes, but the error persists. Do you have this? MACOSX_DEPLOYMENT_TARGET = 10.9

Dazzid commented 2 years ago

I forgot to mention that compiling with the nightly builds of_v20220712_osx, runs smoothly.

danomatika commented 2 years ago

I wouldn’t close this since our releases are based on OF releases and the current release 11.2 has this issue. We do not tests against nightly builds of the current OF git master as it’s too much of a moving target.

Better would be to find the actually change that fixes this and add a note in the readme for what people can do to modify OF 11.2… assuming it’s and easy change.

Please reopen for now.

enohp ym morf tnes

Dan Wilcox danomatika.com robotcowboy.com

On Jul 20, 2022, at 8:42 PM, David Dalmazzo @.***> wrote:

 Closed #19 as completed.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

Dazzid commented 2 years ago

I also opened the question in OF forums, and of_v0.11.2 won't compile in C++14 with an easy change

danomatika commented 2 years ago

Can you add a link to your forum post?

Dazzid commented 2 years ago

yes, here it is. It seems that of_v0.11.0 should be fine https://forum.openframeworks.cc/t/need-help-switching-to-c-14/40099

danomatika commented 2 years ago

If the issue is that C++14 won't work but C++17 will, then use C++17. This addon requires a minimum of C++14 but 17 should be fine.

danomatika commented 2 years ago

I'm closing this for now as I'm not seeing this issue OF 0.11.2 on macOS 12 with Xcode 14.