Problems with MinGW g++ and eclipse with CDT - c++

Background Info: I am running Eclipse Mars and Windows 10
I'm going to list out all the steps I've taken so far:
Download MinGW
Install MSYS installation for MinGW Developers (I don't think I needed this?)
Install mingw32-base
Install mingw32-base
Install mingw32-gcc-g++
Install msys-base (Don't think I needed this either)
Add MINGW_HOME Environment Variable and MINGW_HOME\bin to Path.
Check versions of gcc, g++, and gdb (all showed they were successfully installed)
However, when I open Eclipse I get two errors indicating that g++ and gcc are not in my Path.
How do I fix or get around these errors?

Related

I can't run the gcc compiler in VScode even though I have everything set up

I'm new to programming and I'm trying to set up C and C++,
I have the C/C++ extension pack installed and enabled on VScode,
I have mysys64 installed on the C:\ drive,
I added the Mingw-w64 destination folder path, with \mingw64\bin appended, to the system path in Edit environment variables for your account (windows settings).
The problem is that I can't run the g++ compiler (checking the version also doesn't run) and I'm very sure the address at system path is correct because I've checked it more than 6 times and I've also followed every single step on https://code.visualstudio.com/docs/languages/cpp until Check your MinGW installation (because it doesn't work).
The error messages I get are:
Command 'g++' not found, but can be installed with: sudo apt install g++,
and when I try: "Build Hello World" on https://code.visualstudio.com/docs/languages/cpp
I get:
/image/
Notes:
I run Windows 10 Pro, version: 21H2, OS build: 19044.1826
I already had WSL(ubuntu) installed before mysys64
Edit: I used a different machine and followed the same steps, it works there now. Looks like the problem is with the machine
Install WSL extension in VSCode, run VSCode from WSL (WSL2 better because its faster), then install g++ (sudo apt install g++) from WSL; MingW is evil :)

How to re-install GCC 4.9.2 after installation

I am setting up Eclipse CDT for C++ and I installed the GCC compiler from equation.com. I installed it and the code wasn't updating so i decided to re-install. I deleted the MinGW folder and tried to run the installer again and now getting an error from the installer "System cannot find the file specified".
Also any help on uninstalling Code::Blocks as they are the same category of packages without magic uninstalling would be great.

Install an old version of MinGW GCC

I need to compile the source code of an application that was successfully compiled using MinGW GCC 4.8.1 the last time. I tried to use the most recent version of the compiler that is available in the MinGW Installation Manager but it doesn't work.
I would like to install the 4.8.1 version but I can't find it in the packages of the Installation Manager. I tried to install it using the command line in windows after adding MinGW to Windows'
mingw-get install "gcc=4.8.1"
But it doesn't work either, some packages seem to not get found by the program and it looks like it's installing the most recent version...
Is there a way to install GCC 4.8.1 on Windows as of today ? I'm on Windows 7 pro and I'm on my computer at work so I can't go too deep in the folders and I don't have administrator rights for everything.
Thanks for your help

install wx-widgets is driving me insane on Yosemite

I'm on Mac OS X Yosemite 10.10.2. As far as I know, wx-widgets were preinstalled on older versions on OS X (probably that's why google search doesn't help), but that's not the case anymore. I need to get started on a C++ project using wx-widgets, using any IDE (Eclipse, Codelite, or whatever is best). However, I simply cannot get wx-widgets to work. After a workaround I was able to compile on my machine wxWidgets-3.0.2. I called from terminal make and make install, but the libraries seem to not be correctly installed. Indeed, if I create a project on Codelite I get many "wx-config: Command not found" errors. Can someone help me to get me started on installing the libraries and creating a simple project that includes wx-widgets?
I use homebrew which is installed by copying and pasting one line from the homebrew website.
Then, the installation of wxWidgets is simplicity itself with:
brew install wxmac
Any problems, you just call the doctor with
brew doctor
Now you have a proper package manager you can install ImageMagick, GNU Parallel, GNU awk, Oxygen, webkit2html, zeromq, tree, SDL, Redis, sqlitebrowser, pandoc, exiftool, ffmpeg, 7zip, awscli, etc...
You can then compile your wxWidgets programs with
g++ `wx-config --cxxflags` -o sample sample.cpp `wx-config --libs`
I can successfully compile and install wxWidgets on Yosemite with these commands:
- Get the latest sources of wxWidgets 3 from wxwidgets.org and unpack them.
- Move the unpacked directory someplace where you want to keep it.
- Open a terminal and change into the wxwidgets directory.
- Create two directories: build-release and build-debug (don't rename those!)
- Change into wxwidgets/build-release
- Run
../configure --with-osx_cocoa --disable-shared --with-opengl --enable-universal-binary=i386,x86_64 --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6
- Run make, then sudo make install
- Change into wxwidgets/build-debug
- Run
../configure --enable-debug --with-osx_cocoa --with-opengl --enable-universal-binary=i386,x86_64 --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6
- Run make, then sudo make install
Be aware that these instructions are for compiling against the Mac OS X 10.6 SDK, which I have at /Developer/SDKs/MacOSX10.6.sdk. You can try to omit the --with-macosx-sdk parameter altogether, which will compile using the latest SDK. Also ensure that you have Xcode and the command line developer tools installed.
These commands will install static libraries for the release build and shared libraries for the debug build. You can change this by supplying or omitting the --disable-shared parameter.
The instructions for building and installing wxWidgets are included in the distribution and can also be viewed online.
If your IDE doesn't find wx-config, you must not have the location where you installed it (/usr/local/bin) by default in your PATH. Add it there to fix this.
Like suggested by VZ, you must change your PATH.
But not the variable PATH in your environment Windows but the variable PATH in your C++ project. It's strange but maybe it's different.
Go into (for eclipse) :
C/C++Build->Environment->PATH (add the path of wx-config in the beginning).
Press : Apply, OK and build the project.
I think is strange that Eclipse don't update the PATH after rebooting the OS. Maybe we must add an option to Eclipse for building WxWidget and force Eclipse to update the PATH, but I don't know it.
This change work for me.
Eclipse / MinGW-MSYS / WxWidget 2.8

How do I install Eclipse with C++ in Ubuntu 12.10 (Quantal Quetzal)?

I just installed Ubuntu 12.10, and I tried to install Eclipse and C++, but I failed miserably.
I started with an installation from the Software Center, Eclipse worked, but only in Java. Then I started googling for installation guides and tutorials, but after hours of downloads and installations, the C++ in Eclipse still doesn't work.
So now I have two questions:
How do I clean up this mess?
Actually, how do I know if there is a mess?
According to the Ubuntu Software Center, Eclipse is installed and has three add-ons.
How do I know if the other installations of other Eclipse versions/packagings overwrote each other or if I have multiple installations?
How do I install the latest version of Eclipse and C++ in Ubuntu 12.10?
There is a package called eclipse-cdt in the Ubuntu 12.10 repositories, this is what you want. If you haven't got g++ already, you need to install that as well, so all you need is:
sudo apt-get install eclipse eclipse-cdt g++
Whether you messed up your system with your previous installation attempts depends heavily on how you did it. If you did it the safe way for trying out new packages not from repositories (i.e., only installed in your home folder, no sudos blindly copied from installation manuals...) you're definitely fine. Otherwise, you may well have thousands of stray files all over your file system now. In that case, run all uninstall scripts you can find for the things you installed, then install using apt-get and hope for the best.
I used (the suggested answer from above)
sudo apt-get install eclipse eclipse-cdt g++
but ONLY after then also doing
sudo eclipse -clean
Hope that also helps.
I also tried http://www.eclipse.org/cdt/ in Ubuntu 12.04.2 LTS and works fine!
First, I downloaded it from www.eclipse.org/downloads/, choosing Eclipse IDE for C/C++ Developers.
I save the file somewhere, let´s say into my home directory. Open a console or terminal, and type:
>>cd ~; tar xvzf eclipse*.tar.gz;
Remember for having Eclipse running in Linux, it is required a JVM, so download a jdk file e.g jdk-7u17-linux-i586.rpm (I cann´t post the link due to my low reputation) ... anyway
Install the .rpm file following http://www.wikihow.com/Install-Java-on-Linux
Find the path to the Java installation, by typing:
>>which java
I got /usr/bin/java. To start up Eclipse, type:
>>cd ~/eclipse; ./eclipse -vm /usr/bin/java
Also, once everything is installed, in the home directory, you can double-click the executable icon called eclipse, and then you´ll have it!. In case you like an icon, create a .desktop file in /usr/share/applications:
>>sudo gedit /usr/share/applications/eclipse.desktop
The .desktop file content is as follows:
[Desktop Entry]
Name=Eclipse
Type=Application
Exec="This is the path of the eclipse executable on your machine"
Terminal=false
Icon="This is the path of the icon.xpm file on your machine"
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE
Name[en]=eclipse.desktop
Best luck!
I was in the same boat. Installed Eclipse, realized need CDT.
sudo apt-get install eclipse eclipse-cdt g++
This just adds the CDT package on top of existing installation - no un-installation etc. required.
http://www.eclipse.org/cdt/
^Give that a try
I have not used the CDT for eclipse but I do use Eclipse Java for Ubuntu 12.04 and it works wonders.