Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Please can someone explain how to compile and build
C++ Blink Project
(Linux/Raspberry PI Project in VS2017 15.5.5) code with -std=c++1z or -std=c++17 (g++),I have raspberry 3 model B set up and latest raspbian OS, I successfully connected and build my code and run with C++11/C++14 standard (default configured),
but I want to implement C++17 features with my code such as
std::variants/optional
so on.
I think current gcc environment set up with VS2017 not supported std::c++17,I added these parameters as project C/C++ -> Command line argument,but required headers and compiler support wasn’t there.
How can I compile and build my C++17 standard code into raspbian/Raspberry Pi system using VS2017 Crossplatform(Linux) build system with external GCC/G++ compiler which supports latest standard (std=c++latest) ?
Thank you.
–
The GCC version that comes with Raspbian is outdated and doesn't fully support C++17. You need to install a newer version of the compiler.
There's various guides on the net on how to do that.
This one
, for example.
–
–
–
–
–
If you set
C++ Language Standard
to
Default
in the
C/C++ : Language
properties page (2nd screenshot) and
add
-std=c++17
to
Additional Options
at the bottom of the
C/C++ : Command Line
page, VCLinux will add your option to the command line it sends to the Linux remote and not put in another
-std=
option of its own.
I've tried this against GCC 6.3.0 on Debian 9 (Stretch) which I believe is also the current Raspbian version. GCC 6.3 has only partial support for C++17 and it reports
__cplusplus
as
201500
, without it
__cplusplus
is 201402 (which is C++14, the default in GCC 6.3). So the command line option is being actioned.
9-Feb
I take it from your comments that you are now able to compile and build C++17 code on the Linux remote.
IntelliSense runs on the Windows host and relies on the Windows compiler. For this reason it will not recognise
g++
extensions. At the time of writing, C++17 is not available as an option for VCLinux and therefore language features new to C++17 are not recognised. Presumably support will be added at some point. If you are only interested in new runtime library features then you could try bringing GCC headers onto the Windows host; this topic might be helpful in that regard
Linux header file not recognized in Visual Studio 2017 Linux Project
.
–
–
Thanks for contributing an answer to Stack Overflow!
-
Please be sure to
answer the question
. Provide details and share your research!
But
avoid
…
-
Asking for help, clarification, or responding to other answers.
-
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our
tips on writing great answers
.