Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Dazzid opened this issue Jun 13, 2022 · 14 comments
Closed

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

Dazzid opened this issue Jun 13, 2022 · 14 comments

Comments

@Dazzid
Copy link

Dazzid commented Jun 13, 2022

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
Copy link
Member

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
Copy link
Member

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
Copy link
Author

Dazzid commented Jun 13, 2022

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
Copy link
Member

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
Copy link
Author

Dazzid commented Jun 13, 2022

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

@danomatika
Copy link
Member

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
Copy link
Author

Dazzid commented Jun 14, 2022

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

@Dazzid
Copy link
Author

Dazzid commented Jul 20, 2022

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

@Dazzid Dazzid closed this as completed Jul 20, 2022
@danomatika
Copy link
Member

danomatika commented Jul 21, 2022 via email

@Dazzid Dazzid reopened this Jul 21, 2022
@Dazzid
Copy link
Author

Dazzid commented Jul 21, 2022

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

@danomatika
Copy link
Member

Can you add a link to your forum post?

@Dazzid
Copy link
Author

Dazzid commented Jul 21, 2022

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
Copy link
Member

danomatika commented Jul 21, 2022

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants