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

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!

Related

codelite scan could not locate mingw any on your machine error

I installed mingw and checked it in cmd by writing c++ --version it runs sucessful but whenever i open my codelite it says could not locate any mingw on your machine i have tried reinstalling both mingw and codelite few times nothing works someone please help me
Tried scanning mingw compiler on codelite but it could not locate mingw and it(mingw) is already installed in my machine and running too help me please
I don't know much about this IDE but this link is probably what you are looking for.
https://wiki.codelite.org/pmwiki.php/Main/AddNewCompiler
Since the scan failed you will have to manually add the path to your compiler in codelite. The compiler will most likely be in the mingw folder under the name 'g++.exe'.

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.

GDB on NetBeans 8.2 not starting (Windows)

I've successfully installed NetBeans 8.2 on my system. I've also installed MinGW and MSYS to make it compile C/C++ projects and it works flawlessly. The problem is that whenever I try to debug a program it gives me two errors:
Selected console type is not supported in your configuration, using
External terminal instead
and
GDB has unexpectedly stopped with return -1.073.741.701
and GDB is stuck loading until i press Cancel.
I noticed that if I go to C:\MinGW\bin\gdb.exe it says that the application cannot be started (Error code: 0xc00007b).
Maybe that's because I followed the official tutorial for installing MinGW and MSYS, but I wasn't able to install GDB correctly because point 15 says:
Unzip the gdb-7.0-2-mingw32-bin.tar.gz to your C:\MinGW directory so
that the gdb executable is installed into your C:\MinGW\bin directory.
but if I unzip the files, there are bin and share directories (which overlap with the existing ones), so I chose to cancel.
I could have found the issue, but I'm not sure. I ran Dependency Walker on gdb.exe and it reds out ZLIB1.DLL and KERNEL32.DLL. Do I need the 32-bit version of them? If so, where can I find the downloads?
Screenshot:
Not unzipping the files is almost definitely the problem. There is probably a dependency that doesn't, causing a runtime error.
Problem solved: as I mentioned in my edit, the problem was the 64-bit version of ZLIB1.dll, so I downloaded the 32-bit version and put it inside C:\MinGW\bin. Now everything works perfectly. Thanks to #bremen_matt for suggesting me that it was a dependency issue.

Qt Creator Compiling Error at step 'make'

I just started using Qt Creator for creating C++ GUI programs. I just downloaded it and installed it, but the compiling process is throwing me errors. When I try to compile my project (very simple, just a QLabel on the screen...it's my first project) it comes up with the error:
qtcreator_ctrlc_stub: Command line failed:
C:\Users\andrew\Dropbox\Programming\C++\build-
FirstGUIApp-Desktop_Qt_5_1_1_MSVC2012_32bit-Debug\Makefile 10:04:35:
The process
"C:\Users\andrew\Dropbox\Programming\C++\build-FirstGUIApp-Desktop_Qt_5_1_1_MSVC2012_32bit-Debug\Makefile"
exited with code -1. Error while building/deploying project
FirstGUIApp (kit: Desktop Qt 5.1.1 MSVC2012 32bit) When executing step
'Make'
I hunted around for an answer here and here and a couple other places but I'm just confused about the whole thing. I have a couple of ideas of my own but I don't know how to try my ideas. Here are some of my ideas:
1) MinGW isn't in the path or isn't installed
But, if it isn't in the path, how do I put it in? Where is it? I have Code Blocks installed which has MinGW installed, so could I maybe use it from there?
2) the make file is messed up somehow
Again, what could be wrong and how could I fix it?
3) Qt Creator isn't installed correctly.
Obviously, re-install it, but I want to make sure all other options are tried before, because it took me a very long time to download.
I apologize if I'm sounding noobish or it's a stupid question, but I really am confused with all of this. Please be patient with me and try to explain things well and thoroughly. I'm using Windows 8.1 and downloaded the offline installer. Thanks in advance.
UPDATE
Here is a screenshot of my Qt, how can I tell if it is the visual studio or minGW version?
UPDATE
Here is my MinGW Folder in CodeBlocks. Is this the folder with the compiler or is it something else?
For your ideas:
1: if you downloaded from qtproject with binary. then qt and qt creator should be installed under the C:\Qt\Qt5.1.1 then corresponding minGW should be stay in C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\gcc.exe
this is the directory you need. Remember, QtCreator needs two tools to make sure your project and compile and run, qmake and compiler.
Qmake is tool help you translate .pro file into makefile,
compiler (gcc) minGW use gcc to run the makefile, compile your code to binary.
where to figure out tools you are using are correct?
---> qtcreator --> Tools -> Build&Run -> Kits
in here You should be able find different kits, of course you maybe have only one.
Select one, Double check the Qt Version and Compiler is the one you wish to use.
click Manage next to compiler, Every compiler in the Auto-detect should be ok to use.
If you don't see anyone, add one, click Add, MinGW, put C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\gcc.exe like into path. ABI should auto-set depends on your environment.
Answer to your second question, what's wrong with your makefile, no one knows, you should check your .pro, usually makefile are generated by qmake xx.pro. Double check your .pro file and re-run qmake will solve the problem.
in tools->options->build&run check if minGW is actually there in the compiler and kit list
in the project tab (on the left hand side) you can set the environment for the build click the PATH value and add the path to minGW to it (you may need to add a lib and include var so the standard library gets added)
re run qmake from the build menu
double check you have the correct version it looks like you have the visual studio Qt not the minGW version,
Terminal:(in Linux)
sudo apt-get install build-essential cmake libqt4-dev
i'm sorry i dont know why this code works,but i have the same problem in linux and this code worked.

c++ cygwin and eclipse - binary not found error

I've spent hours looking up how to fix this problem but nothing has worked. I have eclipse Indigo with CDT and ive downloaded cygwin and packages such as g++, make file, etc. When I try to execute any code I end up with the error Launch failed. Binary not found. I've also set the system path C:\cygwin\bin. How can I set up eclipse so I can use it as my IDE for c++?
Found the problem, I didn't press the hammer button to build the project first. I've only used eclipse for java and I could just hit run and everything would work fine.
Try downloading MinGW, and using those compilers. The Cygwin tools require libraries that Eclipse may not load. The MinGW executables do not require any additional environment like Cygwin does.
Also, in order to use most Cygwin executables, you need to launch the Cygwin environment first.