Eclipse Cpp g++ command not found (MinGW & CDT Installed) - c++

I am very new in using Eclipse as an IDE and I am facing many problems in configuring it. I may also be asking a few problems that may already be on forum but believe me I've tried almost all that I could have. SO coming towards the problem, I made a simple Hello World program for C++ to test out my config and YES I have installed MinGW and CDT. I have also edited the path environment variable for MinGW, and I chose MinGW GCC as toolchain while creating it and still my simple HELLO WORLD is giving me the error:
/bin/sh: g++: command not found make: *** [src/TEST2.o] Error 127
I have no idea what I have missed in between and it would be very helpful if someone would help me out correctly config my Eclipse :)
PS: I don't know if changing the tool(compiler) in Tool chain editor affects the process but I tried it as well...

Related

Can't build and run in C++ Codeblocks

So I just recently downloaded a C++ IDE called Code::Blocks and made a new project. But when I tried to Build and Run it, the code gave some errors. I know that it isn't a problem with syntax or anything like that because I ran the default code that Code::Blocks provided. The error is the following:
Project/Target: "firstcpp - Debug":
The compiler's setup (GNU GCC Compiler) is invalid, so Code::Blocks cannot find/run the compiler.
Probably the toolchain path within the compiler options is not setup correctly?!
Do you have a compiler installed?
Goto "Settings->Compiler...->Global compiler settings->GNU GCC Compiler->Toolchain executables" and fix the compiler's setup.
Tried to run compiler executable 'C:\MinGW/bin/gcc.exe', but failed!
Skipping...
Nothing to be done (all items are up-to-date).
It seems to me like there is some kind of issue with the C++ compiler, but I thought Code::Blocks already came with a C++ compiler, so I'm not too sure what the issue here. I also followed their instructions to go to Settings->Compiler...->Global compiler settings->GNU GCC Compiler->Toolchain executables, but I'm not too sure what they mean by fix the compiler. Here is a screenshot of what I'm seeing:
Also here's info on my PC if you need it:
At this point I'm not too sure what to do to fix this problem. I have asked my friends about this problem(they have already successfully downloaded and used Code::Blocks), and they said that they never encountered this problem while they were installing it.
You need to ensure that you have a working installation of the GNU Compiler Collection, and that the paths you select for your toolchain exist.
If you don't already have GCC Installed, the easiest way would be to download a Code::Blocks distribution that comes pre-bundled with MinGW from the download site. However, it's also possible for you to install GCC through other means, such as:
Installing GCC with MinGW through msys2, or
Installing GCC with scoop install gcc on Windows
In either case, you need to select the installation path that contains the bin directory when setting up the toolchain in Code::Blocks.
In case you didn't notice, C::B formed the path to compiler with both "\" back slashes and "/" slashes, which simply isn't a valid Windows path !!
Slashes are used in Linux not Windows! But for some reason C::B is not getting this. And probably your Mingw is well set !!
C:\MinGW/bin/gcc.exe should be C:\MinGW\bin\gcc.exe
I had pretty hard time trying to fix this in win 7 32 bit/C::B version 20.03 but with no success, i checked all available options and settings, and actually i started to think that it's a bug.

CLion Cygwin (32 bit) version 2.11.2 GDB Debugging Error 0xc0000135

EDIT 1
This seems to be related to linking to the mono library, once I remove any kind of reference to mono code and remove the linking to the library from my CMakeList.txt file, debugging works as expected.
EDIT 2
Okay, I've discovered something interesting. This actually might not have anything to do with how I am linking libraries, it appears to be directly related to how I am initialising a class in my unit test. For whatever reason, if I use my normal syntax of TypeDeclaration variableName; the unit test fails immediately with the error code 0xc0000135, but if I change it to read TypeDeclaration variableName(); the code will run. Only problem is that I then get a warning stating empty parenthesis interpreted as a function declaration. I came from linux using g++ to compile my code and there was never an issue, now all of a sudden trying to compile on windows using cygwin or mingw means I can't use the normal standard c++ syntax to actually do work...
Edit 3
I've discovered that this issue is occurring because the libraries I am dependent on aren't actually being copied into the build directory of my unit test project. If I manually copy the required libraries into my build directory debugging works as expected, will need to learn how to express this requirement in CMakeList.txt
More Details
CLion Specifics
CLion 2018.3.1
Build #CL-183.4588.63, built on December 5, 2018
JRE: 1.8.0_152-release-1343-b16 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Toolchain Settings
Cygwin 32 bit version 2.11.2
CMake version 3.13.1
Make version 4.2.1
gcc version 7.3.0
Debugger Cygwin GDB version 8.1.1
catch.hpp for unit testing.
Problem
When debugging a unit test, CLion reports the following error:
During startup program exited with code 0xc0000135.
Google returns a lot of Qt and netbeans related results, everyone suggests to add C:\mingw\bin to the system PATH variable. However I am not using mingw I am using cygwin. I tried adding C:\cygwin\bin to my PATH directory but that does not help. I also tried switching toolchain to use mingw to see if that would help. but the same problem occurs with debugging.
Not sure what else I can do to proceed in resolving this one, any ideas would be most welcome.

What do I have to do to set C++ development in eclipse?

I am currently trying to set my eclipse so that I can start c++ development on my Windows computer. However, I am stuck with some errors. But first, here is what I did so far:
Installed the CDT for Eclipse
Installed Cygwin (with the additional packages gcc, gcc and make)
Added all "paths for headers" in Eclipse
The problem is that when I try to run my Hello World program, I get Launch failed. Binary not found.
I already build and rebuild the project but the program is still not running. It must be because of these errors that I have:
/bin/sh: g++: command not found
make: ***[src/HelloWorld.o] Error 127
What can I do to solve these errors?
Try running the Cygwin setup.exe again and select the packages for g++. Search for that and make sure those are installed. It should be under the name gcc-g++. The C++ compiler is installed separately from the C compiler.
Ok, I figured it out by myself. Since this really freaked me out, I want anyone else who has this problem to know how I solved it.
So apparently, since I had g++, gcc and all that installed, it had to be a problem with the path.
So what I did was check my path. If you don't know how to edit it, check this link http://www.computerhope.com/issues/ch000549.htm
So in there, I chose Path under the System variables and clicked on Edit.... What I noticed was that instead of C:\cygwin64 it said C:\cygwin. All I did was append the 64 (since I had installed the 64-bit version of cygwin) and I was done.
I restarted Eclipse, cleaned and built the project and the errors where gone!

Failed to clean when building wxwidgets using MinGW

I have a problem when cleaning wxwidget using MinGW. The last error is like this :
make (e=2):system cannot find the file specified.
mingw32-make : *** [clean] error 2
and it seems like all of the errors are the same as the one I posted above, and that errors can be seen from the start of cleaning process (after typing mingw32 clean instruction).
Do you know how to solve this?
I have already followed every step mentioned in wxwidgets wiki and any other wiki that explain the way to install this. Of course I didn't install MSYS or anything mentioned in the wiki, just minGW only (and Code::Blocks, but both of them are installed separately).
BTW, I am using the latest stable minGW (3.8x) and the version of the wxwidgets I am getting problem with is 2.9.4.
Any help would be appreciated. sorry for my bad english :)

Eclipse CDT Binary not found - Mac OS X Lion

On my MacBook Air I need to use Eclipse to make some c++ programs for school. So I downloaded Eclipse for C++ from the eclipse.org and made a little Hello World program. However, when I try to run the program, it just gives me the error "Launch failed. Binary not found".
When I try to build the program, this is the output:
**** Build of configuration Debug for project HelloWorldC ****
make all
Cannot run program "make": Unknown reason
Error: Program "make" is not found in PATH
PATH=[/usr/bin:/bin:/usr/sbin:/sbin]
**** Build Finished ****
However, I tried to make a hello world application in Xcode and that works perfect...
Unfortunately, I cannot use Xcode because the teacher is only allowing Eclipse projects...
I found the solution.
The problem is that you can install the latest Xcode (4.3) only from the app store, and by default it seems like the c++ compiler is only accessible through Xcode, to solve this you need to:
Open Xcode
Go to Preferences
Go to Downloads
Install Command Line Tools
Make sure the "UNIX Development Tools" are installed with the Xcode installer.
I don't have Eclipse here, but on my Mac book which make gives me:
correa$ which make
/usr/bin/make
which is one of the paths it's looking for.
If I remember correctly, it was installed simply installing Xcode from the app store. You should try to check if make is really installed in your system, if not, you could try reinstalling xcode to see if it fixes the problem.
Hope this little bit can give you a starting point. Can't yet comment on the question, otherwise would have just made a comment.