SDL_Image IMG_Load fails on png with: "Failed loading libpng16-16.dll:" - windows

Whenever I try to load a PNG using SDL_Image's IMG_Load function it gives the error Failed loading libpng16-16.dll:. I have all the right dll's in the right path and I can use other parts of SDL_Image, but for some reason it can't load the libpng dll. How can I fix this? Any help is appreciated.

It appears that libpng16-16.dll has a dependency on zlib1.dll for MinGW-w64 (32-bit). Try to include zlib into your dependnecies--include the DLL in the folder where the executable runs.

See my article "SDL2: Loading Images with SDL_image":
If you're going to run from Visual Studio, make sure the image is in the same folder as your main.cpp file; otherwise if you're running straight from the executable, the image should be in the same folder with it.
Needless to say, what I wrote about the image here goes for the DLLs as well.

The VS do not searches dlls on anywhere except the execution dir, so you probably need to copy that dll to the Debug/ directory on your solution's path.

Very niche answer, but for those running into this issue because of pySDL2, it could be caused because your python interpreter is sub-par. For me, using the windows store install for python interpreter 3.10, gave this issue. However, when I switched to 3.10 from python.org all my issues were fixed.

This link show you how to set up SDL library/libpng16-16.dll to be available for acceess by the compiler.exe (the last step right before the sample code)
yourProgram proprety page -> Builds event-> post-build event
in my case i have
copy “C:\Users\MehdiB\Desktop\C Program\Library\SDL2-devel-2.0.4-VC\SDL2-2.0.4\lib\x86\SDL2.dll” “$(OutDir)SDL2.dll”;
copy “C:\Users\MehdiB\Desktop\C Program\Library\SDL2_image-devel-2.0.1-VC\SDL2_image-2.0.1\lib\x86\SDL2_image.dll” “$(OutDir)SDL2_image.dll”;
copy “C:\Users\MehdiB\Desktop\C Program\Library\dll\libjpeg-9.dll” “$(OutDir)libjpeg-9.dll”
here where you can get this dll

i just replaced zlib1.dll in system32 and SysWOW64 with the one downloaded from
https://github.com/OctaForge/OF-Windows/blob/master/bin_win32/zlib1.dll
.and worked nicely

Related

GTK 3 setup: Procedure entry point deflateSetHeader could not be located DLL libgio-2.0.0.dll

I am attempting to set up GTK3 for development on Windows 10 following the instructions on tarnyko.net
using the 64bit 3.6.4 bundle from here. The test program currently builds without errors, using the generated options. When I run the program a dialog appears displaying the error message:
Procedure entry point deflateSetHeader could not be located in the
synamic link library C:\Gtk\bin\libgio-2.0.0.dll
From what I can tell so far, deflateSetHeader is a function in zlib that was not present in older versions - a possible cause for the error. Looking in the header file of zlib that came with Gtk, it lists the function.
I have copies of zlib1 in my Gtk bin dir and MinGW (GCC v7.2.0) bin dir.
I tried swapping the versions between directories, but no joy. Don't have much else in my environment path variable, except for a vanilla Python 3.6 install. Don't have zlib1 in SysWOW64. I tried adding -lzlib1 to my gcc compiler options, but that didn't seem to make a difference. I'm running out of ideas now.
Anyone know what might be causing this?
Found the cause by searching my C drive for zlib and found a copy in
C:\Program Files\Intel\WiFi\bin that was causing the problem.

Py2Exe detected as virus. Alternatives?

So, I created a python program. Converted to exe using Py2Exe, and tried with PyInstaller and cx_freeze as well. All these trigger the program to be detected as virus by avast, avg, and others on virustotal and on my local machine.
I tried changing to a Hello World script to see if the problem is there but the results are exactly the same.
My question is, what is triggering this detection? The way in which the .exe is created?
If so, are there any other alternatives to Py2exe, Pyinstaller, cx_freeze?
You can try nuitka.
pip install -U nuitka
Example:
nuitka --recurse-all --icon=app.ico --portable helloworld.py
Website:
http://nuitka.net/
Maybe you need to install Visual C++ 2015 Build Tools for compile.
http://landinghub.visualstudio.com/visual-cpp-build-tools
If you download Nuitka package, you will find a Trojan files in the folder.
If you use this library, you will create a exe file with a Trojan embedded in the exe file.
It converts files much faster than other similar libraries with no errors.

mingw-w64 installer "the file has been downloaded incorrectly"

I am trying to install mingw-w64 onto Windows. However I receive an error, "the file has been downloaded incorrectly". Redownloading the setup file again from sourceforge does not fix the problem. Is there an alternative way to install it or am I doing something wrong?
Old post but same problem, the installer doesn't seem to work.
I give the solution which works for me
You can directly download the archive of MinGW64 with your chosen configuration :
https://sourceforge.net/projects/mingw-w64/files/mingw-w64/
Once the compressed file downloaded, you have just to extract and copy/paste the MinGW64 folder( with the pre-compiled librairies) to your chosen folder ( in my case : C:\mingw64)
I got same error and solved it, after struggling a few hours. You should download MinGW64 via https://winlibs.com/#download-release.
After downloading, You should unzip mingw64 file to a folder(in my case I unzipped it to c disk; C:\mingw64)
And then you have to set up path. for that follow below steps;
open settings.
Search for Edit environment variables for your
account.
choose path variable and then select edit.
Select New and add the Mingw-w64 folder path(bin folder). In my case, I added (C:\mingw64\bin).
Select OK to save the updated path.
And reopen your cmd, then check if everything is good by typing; gcc --version
Long story short, the official installer is broken and not been fixed for years, so we have to install it manually.
The official download link above would bring you to sourceforge: https://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win32/Personal Builds/mingw-builds/installer/mingw-w64-install.exe
And in the same folder that contains the installer, there's a repository.txt. (about this file)
Take a look at it, the installer basically just download and unzip the build from one of these urls within repository.txt. Choose the url you want and download/upzip it manually. (In my case, I use 8.1.0|x86_64|posix|seh|rev0 setup)
Last, setup the Path environment variable pointing to your unzipped bin folder, let say C:\mingw64\bin, and this should do the trick.
Finally, I solved this problem by downloading this:http://winlibs.com/
GCC 10.1.0 + LLVM/Clang/LLD/LLDB 10.0.0 + MinGW-w64 7.0.0 - release 3 (LATEST)
Win32: 7-Zip archive* | Zip archive
Win64: 7-Zip archive* | Zip archive
and set the %path%
After that, I still can't execute gcc correctly, but then I solved the problem by adding this environment variable:
"CGO_ENABLED=1"
I encountered the problem when using this golang package: https://github.com/mattn/go-sqlite3
I received the same error. When I re-ran the installer as an adminstrator it was installed successfully.
I also made sure not to add any spaces to the installation path.
Following this tutorial helped me manually install MinGW for windows : youtube
So the problem for me was that when I tried to use the .exe installer, it either showed me that,
"the file has been downloaded incorrectly" , or , the /.../bin folder did not have any files in it.
In the link above, the MinGW files (including the /bin files) were manually downloaded and identified properly by the Environment Variables.
The problem is with your internet connection and/or ISP. I'm not great at networking so I'll let others be more specific. I tried installing/downloading it using my mobile's data as wifi hotspot and it worked. Hope it helps

MinGW / gcc: The application was unable to start correctly (0xc000007b)

I have been using MinGW and the GNU Fortran compiler for a while in order to compile Fortran programs on Windows, which has always been a successful method. However, I have been getting the following error for the past 4 days:
The application was unable to start correctly (0xc000007b). Click OK to close the application.
The error only happens when running applications that I wrote myself, and that I compiled using the MinGW/gfortran combo. When compiling using Visual Studio and iFort, I have no problem running the applications. The error seems retroactive: applications that were compiled using gfortran a long time ago and ran perfectly until now also break, even though I didn't recompile them. This leads me to think that it is a dynamic library problem. Online searches show that it probably is a compatibility problem between a 64-bit dll and a 32-bit application
I am using Windows 7. One of the latest things I remember doing before starting to get the problem was trying to update MinGW ; I used the mingw-get update and mingw-get upgrade command lines.
After looking around online, I have tried the following fixes:
- reinstalled the Visual C++ Runtime Environment
- reinstalled the .NET framework
- downloaded and replaced a bunch of .dlls like mscvr100.dll, mscvr100d.dll, etc...
- uninstalled and reinstalled MinGW in order to make sure I had the latest gcc version
- run Dependency Walker on a simple application ("Hello World!" type program)
Dependency Walker tells me that a number of .dlls cannot be found (full list: API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL, API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL, API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL, DCOMP.DLL, GPSVC.DLL, IESHIMS.DLL).
It also highlights in red the libquadmath-0.dll (on which libgfortran-3.dll seems to depend). Indeed, it seems that libquadmath-0.dll is a 64-bit DLL in the middle of a 32-bit program. When opening said .dll with Dependency Walker, I can see that all the modules in this library are x86 except the library itself which is x64 (CPU column of DW). I am not exactly sure how this is possible / how to fix it. The library is found in the Python/Anaconda folder (I installed Python and Anaconda a few weeks ago, the problem did NOT appear at that time).
If anybody has an idea of how to get my environment to work again without reinstalling Windows, I would greatly appreciate it! Thanks!!
I had a similar problem. Looking at Dependency Walker I wasn't loading API-MS-WIN-CORE entries. However, when I went to edit my path it turned out that by bin folder wasn't on the path. Adding, in my case the mingw64 bin folder to the path fixed this issue for me. I only mention the API-MS-WIN-CORE entries since I thought it might be the problem, but in reality it wasn't causing my issue.
I was getting this same error code, and used Dependency Walker to discover that, in my case, the 64-bit version of libwinpthread-1.dll was not being found. This helped me resolve my issue.
So, the solution is to determine the missing dll, track it down on your system and reference its location in your path variable, or find out how to install it if you don't have it.
That said, I also came across the following caveat that's important to know about when using Dependency Walker. It's currently out of date and will actually show false results for WIN-CORE dlls: https://stackoverflow.com/a/36244483/4438237
To work around this, there's a newer program called Dependencies by lucasg, that properly interprets these and won't mistakenly tell you about these falsely missing dlls.
I was getting same Error, as mentioned in above answers the problem is "path not being set" aside from setting path you can alternatively Do this; if u don't want to set the path for some reason:
Open CMD
cd C:\MinGW\bin to navigate to the bin directory of mingw
now u can compile the code as following Gcc (dir of ur .c file) -o (ur output dir) for ex : gcc I:\dir\Hello.c -o I:\dir\output.exe
alternatively if u want to automate the process u can make a batch file to automatically do it for you.
here's the batch file if anyone needs it
#echo off
C:
cd \MinGW\bin\
gcc I:\dir\*.c -o "I:\dir\Output.exe" Rem Replace "dir" with your own directory and * with ur own FileName!
pause
I had a similar error but over came it by editing my environment variables.
I had g77 as part of my path variables and by removing it and leaving gfortran alone, the error disappeared
I was on Windows 10 using cmake-gui to generate a MinGW-w64 project and meet same problem.
My solution: go to start windows, search and open MinGW-w64 terminal, then in terminal call cmake with specifiying cmake options.
Yes the old posts got it right. It is the environmental parameters messed up. I got the same error. It is solved by putting the msys64 path to the first:
Path=c:\msys64\mingw64\bin;%PATH%
The msys64 path was the last, now it is the first. Type it once at the command line after Windows started, or edit the Path environmental parameter if you have the admin right.

freeswitch noob cant build solution

im just starting out with FreeSwitch, i downloaded via git, and am trying to build in VS
all i need i believe are the dlls of mod_managed, as my goal is to manage FS via .net
but i get 248 errors, most look something like this:
Error 5 error C1083: Cannot open source file: '....\jpeg-8d\jaricom.c': No such file or directory D:\FreeSwitch\freeswitch\libs\win32\libjpeg\c1 libjpeg
btw, i searched windows and cannot find any such file anywhere on my pc.
I tried
cleaning the solution first, but it did not help
moving the file to a path without spaces
downloading with autocrlf=false
building on another machine
but none of these steps helped
anybody have any idea?
if i can just download the dlls i need, i wouldnt mind skipping this step altogether
environment
win 8 64bit
visual studio 2012
thanks a million
The libjpeg sources are not in the git sources but are normally downloaded during the build process. If you build the entire solution that should not be a problem since it has the project dependencies set: libjpeg.2012 depends on Download libjpg.2012, which means the latter gets built before the first. All Download libjpg.2012 is run a cscript which downloads libjpeg from http://www.ijg.org/files/jpegsrc.v8d.tar.gz (see inside the project file).
So if you do not have the sources, either you are building incorrectly (not in VS for instance, or with a broken solution file) or the download script is broken. In that case, you should inspect the output: I assume it shows errors when it can not download the libs.

Resources