ofxTensorFlow2 icon indicating copy to clipboard operation
ofxTensorFlow2 copied to clipboard

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

Open Dazzid opened this issue 3 years ago • 13 comments

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?

Dazzid avatar Jun 13 '22 13:06 Dazzid

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?

bytosaur avatar Jun 13 '22 14:06 bytosaur

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?

danomatika avatar Jun 13 '22 14:06 danomatika

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'

Dazzid avatar Jun 13 '22 15:06 Dazzid

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?

danomatika avatar Jun 13 '22 15:06 danomatika

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

Dazzid avatar Jun 13 '22 17:06 Dazzid

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?

danomatika avatar Jun 13 '22 18:06 danomatika

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

Dazzid avatar Jun 14 '22 12:06 Dazzid

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

Dazzid avatar Jul 20 '22 18:07 Dazzid

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.

danomatika avatar Jul 21 '22 08:07 danomatika

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

Dazzid avatar Jul 21 '22 08:07 Dazzid

Can you add a link to your forum post?

danomatika avatar Jul 21 '22 18:07 danomatika

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

Dazzid avatar Jul 21 '22 22:07 Dazzid

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 avatar Jul 21 '22 22:07 danomatika

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

danomatika avatar Oct 20 '22 08:10 danomatika