C++: How do you run an executable in windows that uses libcurl? - c++

I wrote a utility to grab information off the web using libcurl and written and compiled using Cygwin on a Windows 7 machine. I'd like to be able to run the executable in the windows environment, but when I do I get the error "The program can't start because cygcurl-4.dll is missing from your computer." I'm not sure how to resolve this, because even if I install libcurl for windows it seems like it's looking specifically for the Cygwin version. Ideally I'd like to figure out how to make the program self contained so it can function without people having to install any libraries themselves.

"The program can't start because cygcurl-4.dll is missing from your computer."
You only need to distribute cygcurl-4.dll with your executable to solve this (put the dll into the same folder).
It should be located in the binaries folder of Cygwin.

In order to make your program self-contained, you should try to compile libcurl on Windows as a static library (a .lib file) without cygwin. Some people say that it is doable. If you're unlucky, maybe you should try some other similar library.

Related

How to build c++ code into a .dmg file rather than a .exe file on visual studio 2019 from a windows computer?

How would I build my c++ code into a dmg file other than a exe file which is what it always builds into. I am trying to make my programs useable by mac users but I cant find answers for this
First off, .dmg on Mac isn't an executable. It's really a packaging tool that includes your executable. If you have a GUI, then what you really need to produce is a .app. If it's just a command line tool, then a binary, just like on Unix. Remember, OSX is very UNIX-like.
I did a Google for "cross compile on windows for mac". Google gave me a bunch of links that go the other way, but if you wade through it, you might find something useful. Depending on what you're building, this is interesting:
https://metricpanda.com/rival-fortress-update-11-cross-compiling-for-three-platforms/
However, if you're trying to write GUIs, you almost certainly need the Mac-specific libraries to link against, and you don't have them.
You MIGHT be able to cross-compile if you switch to Qt as your build environment. I haven't tried that.
If I were going to do this, though, I'd build on Mac. You have to test, anyway, right?

The program can not initialize because SDL2_mixer.dll is missing in the computer

This only happens when I open a specific code in a project. Any other project on my computer using SDL2_mixer.dll is working just fine.
I've tried to put the .dll in the system file, but then this error code appears "0xc000007b".
I've tried to reinstall VS (I'm using 2017 version) and nothing.
I would really appreciate some help in this matter.
Thank you.
Try put dll in folder with executable file.
Try to build that library for your machine -
https://www.libsdl.org/projects/SDL_mixer/
Try bit another version of library.
Check library decencies. Possibly you not have 3rd party
libraries required for that library.

How to run a Qt executable file dependent on .dll files?

So I've finished my Qt application, and I need to implement testing using the Squish testing application (first time using). Apparently I require a working exe file, but I can't get the executable to run. I added all the .dll files to the same directory, only to get the error:
Prior to that I was getting errors saying that XXXX.dll is missing, but like I said, I've added them to the directory. I've tried using both debug and release builds of my project with the same results. I've also tried building a stand-alone executable, but that has it's own problems (one thing at a time). The program runs great in Qt Creator and VS2013...just not on its own.
Any solutions to this?
EDIT:
From Dependency Walker...
0x7B is the error code for invalid image format.
You're either trying to run a 64-bit application on a 32-bit system, or linking to a 64-bit library (ie you copied the wrong DLLs).
Or your binaries are just corrupted.
If you run the application standalone (i.e. not from Qt Creator) you also need the Qt library DLLs. which one you need, depends on the components you are using.
Dependency Walker is also a useful tool to find missing DLLs under Windows.
As for me it seems that something is missing. Qt on windows has the script windeployqt, it will provide all needed dependencies. See documentation http://doc.qt.io/qt-5/windows-deployment.html about use of this. On Windows you will be able to run cmd with loaded qt environment variables ( on Windows 7 see under windows applications menu - it will be available if qt is installed ). As Simon stated Dependency Walker is good tool.

How to run C++ program that use PDCurses on other computers?

I've recently started using PDCurses in a C++ game I'm working on. When I compile the program on my own machine (windows) and run the .exe, everything works as it should.
When I take that .exe onto a different computer that doesn't have PDCurses and I try to run it, I get an error about a missing pdcurses.dll file.
After doing a bit of research online, I found out that including the .dll file along with the .exe should make it run but it didn't work for me.
This is how I compiled the program using MinGW: g++ game.cpp -o game -lpdcurses
So my question is, how do I make this program run on computers that don't have PDCurses setup, and also, is there a way to do this by combining the .exe with whatever additional file(s) the system needs to run the program? I've also read that you can do some sort of static linking but so far I've been unable to find a way to do this.
Thanks in advance for the help.
NOTE: In case it matters, I setup PDCurses following this tutorial: http://comptb.cects.com/1848-adding-pdcurses-to-mingw
Not sure if that was the best way to do it but I'm able to compile and run C++ code that uses pdcurses on my computer fine.
Sorry for not posting the exact messages. Here they are:
The first one I got when I didn't include the pdcurses.dll file along with the executable said :
The program can't start because pdcurses.dll is missing from your computer. Try reinstalling the program to fix this problem.
The second one I got after I included the pdcurses.dll:
*The program can't start because libcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem.*
You need to include all the dynamic libraries you linked with. Be careful of licensing, although IIRC there's not much that will bite you with MinGW.
There should be a 'ldd' command if you have the MinGW shell. Try running it on game.exe and it will tell you what libraries you need to run your program. You need to include them all with the exe.
If you want to try and remove the dependency nightmare you can use the static linking (-static) option to your gcc link command. You may not be able to actually do that if you don't have the static versions of your libraries installed. This has other implications - your exe will be bigger and the OS's shared shared page code will not work because it can't tell what parts (DLL code) you are sharing with other apps. In effect, your application will use more memory as a result, although it may be insignificant.
Another option is to get the sources to PDCurses and compile it as a static library. That way you don't have to get involved in the DLL Hell.
Compile it as a C library instead of a C++ library and you should be good to go.

Setting up midiIO library on Windows

I've downloaded the midiIO library and in the readme it says:
edit the file Makefile.library and set the OSTYPE and OSSUBTYPE to match your hardware/os setup.
type "make library" to compile the library. It will be created as lib/libmidiio.a in unix.
edit the file Makefile.examples and set the OSTYPE and OSSUBTYPE to match your hardware/os setup.
Also, if you are using ALSA, then uncomment out the POSTFLAG to use the alsa library (-lasound).
type "make examples" to compile the example programs in the examples directory. The example programs will be place in the bin directory.
1 + 3 are fine but 2 + 4 are over my head. I've worked in a unix environment before and have used gcc with flags but I need to get this done in Windows. I typically use Visual Studio but don't know how to achieve this with that.. I've downloaded Dev-C++ if that's any use but I don't know what to do with the makefiles?
Ignore the makefiles and set up a fresh project in Visual C++. Make your target a static library (which will be a .lib file in Win32, not a .a file as in unix as you probably know). It is unlikely that the project will build out of the box, so you might have to deal with some compilation errors relating to unix-specific symbols. I took a quick look at the source code, and it looks fairly well-written, so I don't think you should have many problems building it directly in Windows.
Alternately, you could build the source using the real make tool in cygwin, but this means that you would need to distribute the cygwin library with your final product. This may or may not be more trouble than it's worth, especially if you are already using VC++ for the rest of your project's code.