element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Single-Board Computers
  • Products
  • Dev Tools
  • Single-Board Computers
  • More
  • Cancel
Single-Board Computers
Blog Try out C++20 Preview: set up a development environment
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Single-Board Computers to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 26 Oct 2020 11:09 AM Date Created
  • Views 5820 views
  • Likes 11 likes
  • Comments 26 comments
  • c++20
Related
Recommended

Try out C++20 Preview: set up a development environment

Jan Cumps
Jan Cumps
26 Oct 2020

C++ is regularly revised. The current set of proposals are under review. They are called C++20.

There are a few of the proposals that I'd like to try out.

Some simplify object handling. Other move algorithms from run-time to compile time solve.

 

Microsoft and GCC (and others) released a compiler that supports many of the preview options.

Check here for an overview of which compiler supports what.

 

Visual Studio 2019 Community Edition comes with the compiler built-in, if you select the Desktop Development with C++ workload.

By default, the preview options are disabled. Yoou can enable them by selecting your project properties, and navigate to:

Configuration Properties -> C/C++ / Language -> C++ Language Standard.

Then select Preview.

image

 

That's it. You can now write programs that use C++20 constructs.

image

 

For GCC, I used Eclipse 2020-12 for C/C++ developers as IDE and GCC 10.2.0 running in Cygwin64.

To install Eclipse, you download the zip and extract it.

To install the latest GCC in Cygwin, run its Setup program. Select GCC, then proceed to install version 10.2.0.

You can check the results:

$ cygcheck -c gcc-core gcc-g++

 

image

 

Start Eclipse, and create a new C++ Managed Build project.

image

For the first project, check the Cygwin settings.

image

 

Same as in Visual Studio, the C++20 constructs are disabled by default.

Navigate to Project - C/C++ Builod -> Settings -> Tool Settings -> Cygwin C++ Compiler -> Dialect.

Select ISO C++ 20

image

You can now write and debug code with the C++20 options.

Eclipse 2020-12 is not officially released. I witnessed some bugs:

- the editor screen sometimes shows warnings and errors while the compilation and build is clean.

- when debugging, at the end of the main program the debugger is somewhat confused if you step beyond the return().

None of these impact the fun.

image

 

 

There are more options that the two setups that I tried.

 

For the Raspberry Pi, BeagleBoard, Harting Mica, AVNET IIOT GateWay, ...  fanboys

 

The GCC version 10 Windows cross-compiler that supports C++ 20 is now available:

https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads

 

Select this package: Windows (mingw-w64-i686) hosted cross compilers -> AArch32 target with hard float (arm-none-linux-gnueabihf).

Unzip it on your development windows PC, running the extractor program as administrator (so that symbolic links are properly replicated).

Then: build and debug your first GCC 10 Arm program from Windows and Eclipse.

 

image

 

In G++ Dialect, enable the c++20 options

image

 

You can now compile c++20 programs for your Raspberry Pi, BeagleBone, ...

 

image

image: a c++20 program running on the AVNET SmartEdge IIOT Garteway

 

Set the appropriate debugger executable in the debug configuration:

image

 

Voila.

  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 4 years ago +3
    I'm trying some things out on a Pi now. I don't have an arm-linux GCC version 10 cross-compiler, last one released is 9. That gives access to some of the new options. ARM normally releases a next toolchain…
  • Jan Cumps
    Jan Cumps over 4 years ago in reply to Jan Cumps +2
    I have the native build on Raspberry Pi working. Cross-compilation for version 9 works too, but I haven't been able to run a successful remote debug session yet ...
  • shabaz
    shabaz over 4 years ago in reply to Jan Cumps +2
    You're absolutely right, and good to call out the supplier like this. To shout out a good supplier - in the UK there's a chain store called John Lewis, and while it costs more to buy from there, they are…
  • Jan Cumps
    Jan Cumps over 4 years ago

    Microsoft Visual Studio as of today has full C++ 20 support.

    https://twitter.com/fenbf/status/1397491716907847682?s=20

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Andrew J
    Andrew J over 4 years ago in reply to Jan Cumps

    I did nearly create a Debian VM but in the end didn't as I'm not that familiar with Linux so it would be yet another thing to wrestle with.  As I'm not up to speed with C++, I think a lot of features would just shoot over my head right now.  Anything I develop is just for me so 'production stable' doesn't really matter so much.  When I was responsible at work, I'd be forever fighting off staff who wanted to go bleeding-edge for solutions that were already traumatic enough image  I'll soon need to start creating some firmware and I'm suspecting that an Arduino isn't going to cut it memory-wise so I'll be at other MCUs or SOCs which will almost certainly require C++.  Perhaps I'll have to dig out the Renesas board!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 4 years ago in reply to Andrew J

    Andrew J  wrote:

     

    I'm working on Windows 10, rather than Linux.  ....

    I'm trying to get the best of both. A decent Windows PC (in my case a laptop) as development environment.

    A lightweight ARM SoC running Linux (Pi, BBB, ...) as the platform that is too light for development, but excellent as runtime environment, stowed away in a machine, factory or warehouse.

     

    ...  I think for the time being I'll avoid C++20 and stay a little more mainstream

    I did that for the previous upgrades. C++20 is - in my opinion - a milestone though.

    I never blogged about the 11, 14 and 17 revisions. They had great (and in hindsight also not great) features. But nothing to ignite my enthusiasm.

    C++20 does have compelling changes. That's why I'm excited and try to learn them.

    Not advised for production code, because this isn't an approved standard yet. But sometimes it's great to see great thinkers deliver great improvements. They did in C++20.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Andrew J
    Andrew J over 4 years ago in reply to Jan Cumps

    I'm working on Windows 10, rather than Linux.  I think for the time being I'll avoid C++20 and stay a little more mainstream, especially as Eclipse seems sensitive to versions.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 4 years ago in reply to Andrew J

    Andrew J  wrote:

     

    So I downgraded GDB to the same version as you Jan and it works fine.  Obviously V10.1 isn't ready to play with Eclipse yet.

    The good news is that with the new GCC10 windows-arm cross-compiler, the toolchain's GDB client works quite well with the default gdbserver you get when installing on recent Debians...

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube