Coder Social home page Coder Social logo

Comments (7)

susnicek avatar susnicek commented on June 16, 2024

Probably, my avr-g++ version is too old...

from fast-arduino-lib.

susnicek avatar susnicek commented on June 16, 2024

Ok, I used older syntax for nested namespaces in soft_uart.h, line 67

namespace serial { namespace soft { ...}}

...and the compilation was successful.

I thought, that the compiler's switch '-std=c++17' would do all magic, even if the 'avr-g++' version is not the latest, but it would not...

Maybe, it is better to use the old (and ugly) syntax, the most users have older compilers - even me with Debian Unstable distribution.

Best regards, Susnicek

from fast-arduino-lib.

jfpoilpret avatar jfpoilpret commented on June 16, 2024

Hi Suscnicek,

yes your avr-g++ version is pretty old. Nested namespaces (part of C++17 standard) are not supported by g++ version before 6.0.
However, even g++6.0 is not supporting all C++17 standard features and I am not sure 6.0 support would be enough for FastArduino.

In particular, there is much better support for constexpr functions in C++17 which allow simpler definitions of such functions (without such support, it is not possible to have more than one return in a constexpr function, which makes writing such functions more complex and reduces their readability).

For what it's worth, FastArduino is built (on my setup) with avr-g++ 7.4 with various C++17 features (nested namespaces and improved constexpr functions at least), and I don't have plans to support older versions as this is the recipe for bad-looking source code; note that even g++7.4 is not that new actually (released in 2017 I think), but this was the latest version available for AVR targets on fedora distrib, which is my distrib of choice on all my workstations). I generally reserve Debian for servers only (plus Raspberry Pi with raspbian distro).

from fast-arduino-lib.

susnicek avatar susnicek commented on June 16, 2024

Dear @jfpoilpret ,
thank you for your answer. It is ok for me now, I can use the libraries with the slight modification (or maybe later I will try to compile the avr-gcc sources etc.).
One think is not clear to me: the compiler complained on the nested namespace in 'soft_uart.h' but it did not complain on the same thing in 'uart.h'. I only needed to modify the file 'uart_soft.h' to compile the library. Strange...

Susnicek

from fast-arduino-lib.

jfpoilpret avatar jfpoilpret commented on June 16, 2024

Hi @susnicek

I think the main reason why the compiler did not complain for uart.h is that it did not compile anything including uart.h (headers are not compiled during library building only .cpp source files).

soft_uart.h gets parsed by the compiler because it is included in soft_uart.cpp which must be compiled.

When you will use (in an application) FastArduino headers, you may get more of this error. In particular, if you use FastArduino headers for devices support, nested namespaces are also used there.

So in the end, you will need to change nested namespaces whenever you include headers where they exist.

from fast-arduino-lib.

jfpoilpret avatar jfpoilpret commented on June 16, 2024

Issue has been answered and can be closed.

from fast-arduino-lib.

susnicek avatar susnicek commented on June 16, 2024

Yes, you were right.

Thank you!

from fast-arduino-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.