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: reference to 'byte' is ambiguous #35

Closed
OWarneke opened this issue Jul 28, 2021 · 0 comments
Closed

error: reference to 'byte' is ambiguous #35

OWarneke opened this issue Jul 28, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@OWarneke
Copy link
Member

OWarneke commented Jul 28, 2021

SDK >= 2021.6

The SDK compiler was set to C 17

With the SDK version 2021.6 the language standard C 17 has been set in the compiler options (-std=c 17). The firmware itself is also compiled with this option set. Besides some general C issues related to this C 17 standard, the following issue is related to PLCnext: C 17 introduces the data type std::byte which is unfortunately not compatible with Arp::byte. Therefore, if the namespaces std and Arp are both active the compilation, this results in an error. In this case existing C sources have to be adjusted so that they explicitly use Arp::byte (e.g. by adding using byte = Arp::byte;).

Known for firmware on ALL PLCnext devices

[cmake]: [ 71%] Building CXX object CMakeFiles/FileStreamExample.dir/src/FileStreamExampleComponent.cpp.o
[cmake]: /home/myworkpcuser/Downloads/CppExamples/Examples/FileStreamExample/src/FileStreamExampleComponent.cpp: In member function 'void FileStreamExample::FileStreamExampleComponent::WriteToFile(Arp::String)':
[cmake]: /home/myworkpcuser/Downloads/CppExamples/Examples/FileStreamExample/src/FileStreamExampleComponent.cpp:85:19: error: reference to 'byte' is ambiguous
[cmake]:    85 |     stream.Write((byte*) str.CStr(), str.Length(), 0, str.Length());

can be fixed With:

stream.Write((Arp::byte*) str.CStr(), str.Length(), 0, str.Length());
stream.Read((Arp::byte*) str.CStr(), stream.GetLength(), 0,    stream.GetLength());
@OWarneke OWarneke added feature-request New feature or request bug Something isn't working labels Jul 28, 2021
@OWarneke OWarneke self-assigned this Jul 28, 2021
@OWarneke OWarneke removed the feature-request New feature or request label Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant