When I try to run my C++ project in Code::Blocks IDE, it'll run the program in Windows CMD without any problem. If I try to run the program via Explorer it'll also run in CMD without any problem.
However, if I try to run the exactly SAME program via CLion, it'll run fine in CLion itself (CLion has a builtin terminal, while Code::Blocks uses Windows CMD). But if I try to run the program via Explorer I get this weird error:
If I press OK:
Anyone knows what the problem is? How do I fix this?
More information:
Code::Blocks comes as a package with MinGW. With CLion I had to manually download a Toolchain. I downloaded and installed MinGW-w64, because I didn't know anything else and that's what Code::Blocks also used.
The weird part about this is that MinGW-w64 is installed in "Program Files (x86)" and not in "Program Files".
Add the following to your CMakeLists.txt file in CLion:
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-static")
This will work for gcc, which mingw is based upon. For other linkers, you would have to search for their particular switch for static linking.
Related
I need to build my c++ project that I created using CLion as standalone exe-file but I don't know how to do that!
Here is my CMakeList.txt:
Here is my CLion Toolchain settings:
The settings is OK!
But when I build exe and run it i get error:
It says that the program can't be run because "cygwin1.dll" is missing and reinstalling the program could help to fix it.
Anybody knows how to fix that? I can't find cygwin1.dll in cygwin installing client to fix it:
from unknown reason I can't compile a single file/project in C++ in my CodeLite environment.
I'm using latest version of CodeLite, i.e.: 7.0 with pre-installed MinGW libraries. OS/ Windows 7.
Strangely after reinstallation, time and again I get the following error while trying to build/compile C++ project:
C:\Windows\system32\cmd.exe /C " -j 2 -e -f Makefile"
Name'-j' is not recognized as an internal or external command operable program or batch file
When I try to run the program (I was used to click run and get immediate results since it was compiling and running the code at one time) I get absolutely nothing.
Any idea how can I fix this strange issue ? Reinstalling IDE doesn't really help :(
C:\Windows\system32\cmd.exe /C " -j 2 -e -f Makefile".
Do you have MinGW installed? CodeLite 7.0 does not come with MinGW
To fix your problem:
Install MinGW, I recommend using TDM-GCC (make sure you accept the default options by TDM-GCC installer, especially, the install location path)
After the installation is completed, let CodeLite detect your compiler: Settings->Build Settings->Compilers->Add Compiles->Add an existing compiler and point CodeLite to the folder where you installed MinGW
You should now have this compiler configured in CodeLite. right Click on your project and open the settings dialog (keyboard shortcut Alt-F7) : Project settings->Common Settings->General->Compiler and select your compiler from the list
Build your project again, this time it should work properly.
Also, I recommend you to use the latest weekly build (it contains a new "setup wizard" that includes installing a compiler), you can get it from codelite's downloads page
Eran
As we all know, Eclipse can not only run Java project, It also can run C/C++, Python, PHP etc, but we need to install plugins and configure run environment. I want to run C++ Project on Eclipse+cygwin+cdt (Windows 7), I have added following these environment variables.
"C:\cygwin64\usr\include"
"C:\cygwin64\lib"
"C:\cygwin64\bin"
and configure Eclipse toolchain = CygwinGcc and binary parsers = PE Windows Parser, I also set sth about "Paths and Symbols", but I still cannot run C/C++, following is the error info:
"Lauching CTest Debug" has encounted a problem. The program file specied in the launch configuration does not exist."
there is no binaries files, is there something wrong with it? I'm confused.
An executable probably doesn't exist in your debug folder.
There is a thread on how to get c++ running on Eclipse here:
The program file specified in the launch configuration does not exist
Hope that solves your problem
Did you install gcc toolchain successfully in Cygwin? Try to include gcc, gdb and make when you install cygwin.
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!
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.