Mingw resources - Example not working.
I'm trying to link a resource file with mingw. I went to mingw's site, read this tutorial:
But, for making a .c / .cpp file into a .o, it doesnt work. And when I try linking my .o & .cpp, it deletes my cpp file! (Had to make a backup one -,-) I've tried this six times, it does the same thing each time
Here's an example. The following is a code sample for a simple Windows program. Cut and paste it into a file named hello.c to try it out.
int WINAPI WinMain (HINSTANCE hInstance,
MessageBox (NULL, "Hello", "Hello Demo", MB_OK);
If you want to create a Windows executable hello.exe, from a c file called hello.c, try the following:
This compiles hello.c into an object file, hello.o
gcc -o hello hello.o -mwindows
This creates an executable hello.exe from hello.o The -mwindows switch is needed to create Windows executables instead of console applications. It assures the appropriate Windows libraries are linked in for you. To get a console screen along with a standard windows application, add the -mconsole flag as well as -mwindows.
If you have resources from a resource file (.rc) that also need to be added to your executable, you'll need to compile the resource file as well as your other source files and include the compiled resources when linking to create the executable. Here's an example that shows how to compile and link in a resource file named resfile.rc.
windres -o resfile.o resfile.rc
gcc -o hello hello.o resfile.o -mwindows
Likewise when I specify a directory for hello.o. Is this bad documentation or am I just a retard? -,-.
$ g++ -o hello hello.o -mwindows
g++.exe: hello.o: No such file or directory
g++.exe: no input files