I'm trying to compile a program in C on a Windows 7 machine using MinGW. Now I have to admit I don't have a lot of C experience to begin with and this is compounded by not being a very adept Windows user.
The program came with a make file, but it is getting stuck because I get the error:
cannot find -lsndfile
I found that sndfile is a sound library for reading .wav files and the like. I downloaded the library from http://www.mega-nerd.com/libsndfile and ran the setup executable it comes with. This put some header files and other junk in the Programs folder on C drive.
I copied the header files into the include folder under the MinGW directory, which reduced a lot of earlier errors down to one you see above. I think I need to put a .dll file somewhere, but not sure where.
I can provide more detail if needed, since I'm not quite sure where the problem lies.
Thanks for the help.
You have to put the linkable library files (either .a, .lib or .dll) along with the other ones (which come by default with MinGW).
Related
The title basically says it all. It might be a dumb question (which probably is) because I am entirely new to programming. I wonder how the desktop apps we use are made of mostly .dll files when you check their program files, but not even a single source code file? Is there any way to open them, or how can I turn my code file into .dll?
Thats exactly what DLL files are. DLL files are libraries which contain code that is called by the 'main' source code, which is compiled into '.exe' files.
You not being able to see such code is intended by its owner, unless the source itself is released alongside the compiled software. A project may integrate .dll files already developed by someone else instead of developing them from scratch.
As to how to turn your code into a .dll, it would depend on the language you are developing in.
More detailed answers at: What exactly are DLL files, and how do they work?
Short answer: The DLL files are "compiled".
Compiled files no longer rely on their source code. Once compiled they can be executed by the operating system directly.
DLL files are not "scripts". In languages like HTML, Javascript and PHP, the files are interpreted at run time by the browser's HTML or Java engine or the PHP engine on a server. Thus you can also read them since they are not yet compiled. But in the case of a DLL file, the original source code files have been compiled (interpreted and converted) and the result is an executable Library which is used by another program to accomplish whatever tasks are in them.
It is possible to "decompile" them with a decompiler, but that will not give you the original source code, any more than a "jpg" will give you the original layered Photoshop file. All you have is the Result.
I used MySQL Connector C 6.1 api in C.
I linked all the header files, libraries etc in the Code blocks IDE and when I try to compile the program,it works and I am able to run the program. But when I copy the .exe file to another computer, a warning comes saying that libmysql.dll is missing. When I copy that libmysql.dll file along with the program,it works fine. But how to avoid that? Is there a way to make it run without copying .dll file?
If your program depends on a .dll (which stands for dynamic link library) then there is no way to run without that .dll being present on the system. This is because there is code in the library that your program depends on. An alternative would be to build your program with a static version of the library, a .lib file.
Good day, I am working with Codeblock IDE under Windows in C language and I got the static library in file ".a" with the development of some functions. I must see somehow the code of the functions in the file because i need.
I was reading a lot on the forum but I could not solve my doubt.
someone could help? Tanks!!
(People said that this should be an answer, so here it is!)
*.a files are compiled libraries on Windows (the file extension is different on different operating systems). You can't see the source code unless you decompile it (which is very hard or impossible).
(From another comment) However, if the library is from an open-source project, then you might be able to find the source code.
I'm trying to resurrect a 1990's application that was built with Borland Turbo C++ (version unknown, maybe 3.0, maybe 4.5?), and apparently targeted for Windows 3.1.
The project contains a single .c file, and a single .res file. Rather than try to locate the ancient compiler, I've tweaked the C source into compatibility with MinGW gcc ver 4.5.2, thinking I could rebuild it for win32. Unfortunately, this is one of those windows programs where the main window is a dialog box, and the dialog specifications are embedded in the .res file. Of course modern MinGW gcc doesn't understand the old .res format.
So is there a way to recover an .rc file from a 1990's vintage Borland .res file? I know there will be other problems compiling old 16 bit windows code like this, but I can deal with that later (it's only 2K loc), right now the stumbling block is this resource file.
somewhat later ..
I have found 'Turbo C 3.1', but this thing is a trip. It can actually compile for 16-bit windows, the resulting executables requiring an NTVDM to run under XP, but the concept is proved. Tried it on a simple windows hello-world, and it worked.
Anyway, the problem is still the .res file! There was a project (.prj) file with the aforementioned material, but it apparently calls out the .rc source file. I know with gcc, I can link an already compiled resource file into an executable, but heck if I can figure out the strange command line for 'bcc' to do it. To get an idea how odd it is, bcc uses -W as a flag to 'create windows application'. It must be possible. Anybody remember?
(fwiw- i think there may be better tags for this. feel free to re-tag.)
Open Watcom C/C++'s Resource Editor (wre.exe) seems to be able to open 16-bit .res files. If the latest version doesn't work fully (which isn't totally unexpected as very few people work with 16-bit resource files), try earlier ones.
Typically, when I create a program (I have only made a few very simple ones so far) I compile the program into a standalone EXE. Most programs that are distributed nowadays have many exes, dlls, and other files that are installed when you first download the program. Is this wrong to be compiling my programs into standalone EXEs? What are some advantages/disadvantages to a standalone vs multifile program?
The only possible thing I can think of is for updating and fixes, because then instead of having to download a 100MB file and overwrite all user settings data, etc. you can simply download maybe a 400kb file that only replaces the files that need to be fixed.
DLL files are library files. If you are not using any functions from a library, then the DLL files will not be included with your program. Having multiple EXE files are generally a way to break a larger program down into smaller, more maintainable units.
If you're just getting started, this is not something you'll need to worry about just yet. One day, when you're working on a larger project that involves using other pre-built components, you'll dig around in your build folder and notice that you also have some DLL files and other resources.