(Newbie) How install c++ 7.4.0 in windows linux subsytem

oblisgr

New Member
Joined
Jun 3, 2020
Messages
1
Reaction score
0
Credits
18
Hello, i work in windows linux subsytem (ubundu)
This subsystem by default installs g++ 9 on it. But it causes me problems with the things i m working on.
So i used sudo apt-get remove gcc g++ to remove it.
Then i used the following commands i found on net to install the 7.4.0
sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt-get update

sudo apt-get install g++-7.4.0

but i get...

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package g++-7.4.0
E: Couldn't find any package by glob 'g++-7.4.0'
E: Couldn't find any package by regex 'g++-7.4.0'


any help how to successfully downgrade my g++?

update:

i removed the (-) from 7.4.0 ind installed it
but again the version 9 not the one i need...

g++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
Last edited:


Why do you need to downgrade?
What version of the C++ standard are you using in your code?

You can use the -std= option to set the standard you want to use.
I think the default standard used for compiling C++ in 7.4 was c++14. So, in your Makefile, or build-system add the following parameter to CFLAGS, or wherever you’ve defined your g++ compiler command:
-std=c++14

That should force the code to be compiled in the same way as in g++7.4.x..... I think?!
 
Otherwise - just install and use Cygwin. That still uses gcc7.4 by default - though, I admit - that situation might have changed. Not sure how long ago I last updated Cygwin on my Windows 7 PC at work?! Hmmmm...
 

Staff online


Top