How To Add zlib1.dll to MinGW - c++

I am brand new to C++, although I know java pretty well, and I trying to set up compiler. I managed to download MinGW and modify my Path environmental variable. I am not at the point where when I go into the command prompt and type:
g++ --version
I get what Sam-s Teach Yourself C++ in 24 Hours says I should. But when I type:
g++ Hello.cpp -o Hello.exe
I get an error message that says "The program can't start because zlib1.dll is missing from your computer. Try reinstalling the program to fix this problem". I tried reinstalling multiple times, but nothing changed. Looking on Stack Overflow, I found that this is apparently a fairly common problem, and you have to add it to the file yourself.
I downloaded the file, but I can find/figure out where I am suppose to put it. The folder I downloaded is called zlib128-dll and it contains (among other things) the file zlib1.dll, which I think is what I want. What do I do with what to make the error message go away?
Other information:
-Using Windows 8.1
-I think I got the newest version of MinGW, since I just got it about 2 hours ago

It will work if you put zlib1.dll in any folder listed in path variable (or in the same folder with MinGW executable). I think, best way is to put it right into MinGW\bin.

Related

mingw32-g++.exe: error: CreateProcess: No such file or directory again [duplicate]

This question already has answers here:
Yet Another MinGW "gcc: error: CreateProcess: No such file or directory"
(9 answers)
Closed 5 years ago.
I have searched all over and cannot find a solution.
I installed the code::blocks version with the compiler. (Windows 7)
Every time I try to compile, I get the No Such file or directory error.
I thought maybe the spaces were causing the problem, so I downloaded and installed ming alone to C:\GCC\MinGW-w64
I went into the compiler settings/toolchain executables and directed every path so it wouldn't try to read from the Program Files one where code::blocks is installed. Same error occurred. I've also tried going directly to the bin folder.
I've reset to default settings. I've auto-detected. I've uninstalled and reinstalled. I've seriously tried about everything.
Then I thought maybe because it's where I'm saving my projects, since they have spaces. So I put them directly to the c:\ drive. Same error.
This worked the first day I used it, after that it's been this problem ever since. So you'd think reinstalling everything would fix it right?
If anyone has a solution please do tell! Using the exact same installation file on another computer, the compiler works fine, every setting is exactly the same as it is on this one, except on the other one it works.
Here's the error messages. I made a quick console project just to post these errors.
||=== Build: Debug in hhhh (compiler: GNU GCC Compiler) ===|
CreateProcess||No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
mingw32-g++.exe -Wall -fexceptions -g -c C:\Users\Mack\hhhh\main.cpp -o obj\Debug\main.o
mingw32-g++.exe: error: CreateProcess: No such file or directory
Yet every time I go into the toolchain and redo the paths, they are all correct. The files are there, but code::blocks for some reason is not seeing them.
Before coming here, I tried to make an account on the code::blocks forum, but it's broken. Activation email won't send and I can't find any email address to contact support. I've tried registering with a live.com, gmail.com, and mail.com email accounts, and none of them received the activation email.
Also here is the simple Hello World I used that gave me the above errors.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
Here are some screenshots.
Default settings.
http://prntscr.com/9eyoi4
Redirected to the latest compiler install. Redid each path so they all direct to the new files.
http://prntscr.com/9eyqnx
Windows 7 can be particular about where it will allow you to write files. The directory where you installed Code::Blocks itself shouldn't matter as it doesn't write back to it's installation folder, but just in case, I installed mine in C:\Develop\CodeBlocks. Windows 7 will not allow software to write to the program files folder once installed there. Like I said, probably not an issue, but just in case, you may want to move it outside of that location, something like what I have. I also have MinGW 4.8.1 installed it it's own folder in C. I put it in C:\MinGW and pointed to it as you did. Code::Blocks has no problem autodetecting it though.
For my projects, I put mine in my C:\Develop\Projects folder. I am not sure if Windows 7 will allow software to write to your home folder, at least I don't think it's a location that is recommended by Microsoft. If you prefer a location in there, your Documents folder is a safe location to create projects and can be written to. My suspicion is that a file is not getting written at compile time and then, of course, it is not being found and so you get that error.
Incidentally, I am also using Windows 7 (64bit) with Code::Blocks v13:12 and MinGW 4.8.1 (32bit version).
AntiVirus false triggers? Or Windows Defender etc, if the behaviour change was noticed after a system update.
I have C::B 16.01, but installed well away from C:\Program files etc, on Win7(64) and (once I figured out how to point it at some needed third party lib's) it all works fine. So far...
Regards.
DJB.

Can't run C++ in NetBeans: "No Shell Found" error

I'm trying to learn C++ using NetBeans but even though I have CYGWIN and everything set up in my PATH, I keep getting an error that says: "No shell found. Cannot proceed. Please install either CYGWIN or Msys."
I don't know what Msys is but since the error says "or" I assume that if I have CYGWIN that I don't need to have Msys.
I'm trying to run the basic "Hello World!" tutorial but this error from what I've seen isn't covered. I'm getting aggravated because I have a project I need to have done in a few weeks.
If anyone has any answers for me, that would be great. I can supply screenshots if you need them.
Cygwin alone is not enough, first of all you have to check if you installed C++/gcc/gdb packages in your Cygwin.
From Cygwin/Net beans docs:
Open the Control Panel (Start > Settings > Control Panel) and double-click the System program.
Select the Advanced tab and click Environment Variables.
In the System Variables panel of the Environment Variables dialog, select the Path variable and click Edit.
Add the path to the cygwin-directory\bin directory to the Path variable, and click OK. By default, cygwin-directory is C:\cygwin. Directory names must be separated with a semicolon.
Click OK in the Environment Variables dialog and the System Properties dialog.
If it fails you could try to Re-Install Netbeans from/within an cygwin/bash instance start the netbeans from a cygwin/bash instance.
Netbeans should automatically detect gdb/g++
PS: I'd prefer to use a good Gnu/Linux distro
I had the same problem with 8.1.
Adjusting the %PATH%-variable - in my case adding C:\msys64\usr\bin - solved it (as wdavilaneto's slightly verbose answer suggested).
This is not an answer but it adds to this question, I know that isn't very objective but in this case there may be a problem with Netbeans. I have 7.3 so this could be the reason. I am getting the same error but it used to work just fine, then one day it just stopped working and couldn't find the Shell. I have everything you need to make C/C++ work for Netbeans and it was working, for a while too!
It is rather old, but I've had the same issue a moment ago. It "Solved itself" by Creating a new "welcome sample" project and then made it run, then went back to my original project and made it run again. For me, it solved the problem. Probably it is related to an issue with Netbeans as Cian said.
Btw, I'm with Netbeans 8.1.
Make sure the shell is in your path! Depending whether you have Cygwin, Mingw32, Mingw32, TDM Mingw... it will be somewhere here:
c:\<installation path>\usr/bin
Hmh, I have 2 C compilers one for 64bit and one for 32bit set in NetBeans. When I had 32bit compiler without 64bit one then compiling went fine but when I have installed 64bit then NetBeans has started to do some problems, firstly everything went fine but then I started to get this problem to. For me fix is to switch from 64bit compiler back to 32bit compiler, then compile my program and then go back to 64bit compiler and now I can compile it with 64bit compile... Not sure why is this fixing it.
I have this problem with Netbeans 10.
Computer is Windows 10 x64.
Resolved by following the answer given by TNT.
Problem was when start building my project the said "no shell" (the topic of this posting) dialog box popped up. Since there was no command prompt, the build tools cannot run - process cannot spawn.
Solution was to give the correct path (environment variable). Since I am using MSYS, Since I am using MSYS, adding
F:\msys64\usr\bin
to my PATH made it work.

Error: No Mount Point For (/) defined

I am trying to get the NetBeans IDE to work with the g++ compiler. I am downloading from cygwin. I've tried googling the problem and I have tried many things to get C++ to work on NetBeans. I can't figure out the magic trick so I am asking for your help.
I have two problems, I don't know if these problems are related to each other.
Problem one: I get this error when I try to run my small program.
Problem Two:I get a "Cannot find include file <iostream>". When I hold ctrl and hover over the include directory my compiler says Unresolved directive #include<iostream>
I followed this NetBeans Guide on how to install and configure C++ support. Following those directions I had received the two errors above.
Here is what my environment variable looks like: this
Here is what the C/C++ build tools look like for NetBeans: this
Here is the code I am trying to run; this
At the moment I am installing everything from the development tab in the cygwin setup program.
I've tried messing with different settings but the two problems were still there.
I've tried running NetBeans in admin mode but the two problems were still there
I've tried un-installing cygwin and installing minGW. That fixes problem number one, but the there is no output when the program runs.
I've tried adding C:\cygwin64\lib\gcc\x86_64-pc-cygwin\4.8.2\include\c++ to the "Include Directories and Headers" in Properties -> Build -> C++ Compiler. This resolved iostream, but the other directives under iostream had the same problem, that the other include files could not be found.
I've been at this problem for five hours or so. Any help would be appreciated.
Here is what I am running:
Windows 7 64 bit
NetBeans 7.4
If you need anything else, just ask.
The answer was that my firewall, comodo firewall, was sand boxing the files that needed to run. After disabling the sand boxing feature NetBeans ran fine.

MinGW GCC and G++ Errors in Eclipse

I'm new to this community and this is my first question. I know many people had had this problem before, but, it seems as if people solved it their own ways and I tried all the solutions I could find in google (and here, respectively), but none of them seem to work for me like it was supposed to. And just to make it clear, I use 32-bit Windows XP. Some versions that may work in 64-bit or newer operating systems may not work on mine.
So I'm very new to C and C++, I started by installing the Eclipse CDT, the moment I found out it did not have a compiler was when I installed MinGW which was bundled with a C compiler, a C++ compiler, and the MinGW Developer's Toolkit (which included MinSys). So after that, I started by creating a new empty C++ project called 'HyScript'. And did these:
I set the environment variables as:
C:\Program Files\Java\jre7\bin;E:\Mark\MinGW\msys\1.0\bin;E:\Mark\MinGW\bin
Then, I restarted eclipse, deleted the old projects, and created a new one with the same name (deleted the old folders) and chose the toolchair, "Cross GCC".
Now I haven't even started writing code, but there are already 4 errors:
Here's the link to the dropbox file
The last thing I did was open up the CMD before going here, and this happened: Here's another link to the dropbox file
I don't understand anymore... What did I do wrong? I set the environment variables right, I supposed. And, after doing some research, I still can't find a proper solution for me. It's been two days now, and this error still hasn't gone away.
You chose wrong toolchair "Cross GCC". Please select "MinGW"
The latest version of G++ can be found here. Please do NOT install it in the default directory but use this:
C:\MinGW
If you still have problems, uninstall everything you did, and watch these video instructions.

Program can't start because *.dll is missing - MinGW, Eclipse, Windows 7

I am well aware of the fact that a multitude of similar problems already appeared on this board, however none of the solutions helped me.
I am trying to get Eclipse CDT running with MinGW toolchain on Windows 7 Service Pack 1. I already did that on Windows XP and thought that the same procedure will make it run smoothly on Windows 7, but it seems I was mistaken ;)
After installing MinGW from the automatic installer (just in case I installed a few things more than what I needed) and adding the C:/MinGW/bin to my PATH environment variable, I tried to compile a simple Hello, World! program. Eclipse did not give me any errors, but it didn't want to give any output in the Console window. Alarmed, I tried to run the executable file outside of Eclipse and got the error that
"Program can't start because libstdc++-6.dll is missing".
Strangely enough, this dll is in the C:/minGW/bin directory, so the PATH variable should 'find' it - but it does not. Copying the dll to the directory with the executable file helped, but it is obviously a short-term solution and I would prefer to have a more "normal" one.
The thing that makes my problem different, I think, from the others I've noticed on this board is the fact that, for one, Eclipse does not find any errors with my PATH variable (which it usually does, if the MinGW was not included in the Path variable or something), and besides the required dlls are where they should be, but it seems my Windows can't find them.
The "real" solution is indeed to copy the DLL locally. You have to ship that dll when shipping your EXE.