Advertisement

Compiling for Windows using GCC

Started by August 08, 2003 03:59 PM
9 comments, last by GBGames 21 years ago
I want to be able to develop on multiple platforms (Linux, Win32, possibly Mac), so naturally I would like to just change a flag and recompile to create the different executables. As I might try to make shareware, I can''t just go out and buy a bunch of different compilers/IDEs. I am just looking for something free as in beer/speech that allows me to compile to multiple platforms. Google is not making it easy for me, but I did find a few things. - lcc is not free as in beer if I want to publish commercially, so this is not what I am looking for. - gcc is ideal, except I don''t know where to find the details for Win32 development. Again, with Google, I couldn''t find much info on it. Anything I did find made it sound like it has its own GPLed development tools, meaning that my code will have to be GPLed. While I appreciate the GPL, I would prefer to have the freedom to make my own license for my software. - MinGW is apparently some kind of set of free as in beer libraries and headers to use with GCC so that you can create Win32 binaries without the need for third party libraries (those that would affect the licensing of the software created). So the best I can think of is MinGW along with GCC. Anyone had experience with it? Anyone have any other solutions they know of that I just haven''t had the luck of finding?
-------------------------GBGames' Blog: An Indie Game Developer's Somewhat Interesting ThoughtsStaff Reviewer for Game Tunnel
GCC can target many platforms. When you build it you can specify what type of output that build of GCC should produce (it assumes output for the platform it''s being built on by default). You can add a prefix (and possibly change the prefix path) to the binaries so that you can use it alongside an existing GCC installation.

The hardest part of using GCC (or any compiler) as a cross compiler is that you must build all of the non-native libraries you''ll need to link against too. (In practice, it''s only been a minor annoyance for me. I submitted a patch to the only library that ended up being trouble to cross-compile.)

MinGW is a free-as-in-speech set of Windows headers and libraries (only the linking parts of the libraries, as Windows breaks up the linking and the runtime parts for whatever reason) for GCC. It allows you to link against the libraries that should already exist on up-to-date Windows systems (the same libraries MSVC links against). It''s what I suggest you link against when cross-compiling. (If you''re using Debian, apt-get install mingw32 installs a build of GCC using the MinGW headers and libraries.)

If you''re using the GNU buildtools (Autoconf, Automake, and libtool) properly, cross-compiling becomes as simple as (in my case, with the Debian "mingw32" package):
./configure --host=i586-mingw32msvc et ceteramake all


Advertisement
Actually I just reread the license. Apparently it is not free as in speech as far as GNU is concerned, but it is public domain. It would allow one to release the complete software under whatever license he/she chooses, which is exactly what I need.

I guess what bothered me is the wording:

"CAUTION: do not distribute proprietary source with profiling enabled. The profiling library is covered by the GPL which infects your product to conform to the GPL as well."

I thought that sounded pretty anti-GPL in nature, but this does sound like the thing I need.

Thanks!

-------------------------GBGames' Blog: An Indie Game Developer's Somewhat Interesting ThoughtsStaff Reviewer for Game Tunnel
someone reached to use djgpp under windows ?
I'm not sure if this is what you seek, but:

http://sourceforge.net/projects/dev-cpp/

is a free windows development environment based on GCC.

-- Edit:

I don't think your GPL concerns are a problem. It'd be pretty unusual to have a GPL development tool that somehow made the built target need to be GPL; you'd need to tool to do dynamic code generation, including specifically GPL'd code into the code
base it built...

or like you said, a profiler adding run time object code. Wouldn't be a huge problem tho I imagine.


[edited by - Shadow Mint on August 22, 2003 7:52:38 AM]
Try www.eclipse.org this ide supports C++ and is pretty nice.
George M Vigelette
Advertisement
I just want to have the port of gcc and g++ under W32. I downloaded all djgpp we said me (in the site), and followed all instructions..;
finally, it does not work, some links are missing for g++ to find out the needed files.

however i will take a look at sourceforge for this project.

If you have any information about what I want, please just tell me them here !
You might want to take a look at Cygwin, which is a port of gcc and many of the other GNU tools to Windows.
quote: Original post by GBGames
Anything I did find made it sound like it has its own GPLed development tools, meaning that my code will have to be GPLed. While I appreciate the GPL, I would prefer to have the freedom to make my own license for my software.


I''m pretty sure that programs compiled with GCC don''t have to be GPLed. Generaly speaking, the GPL states that if you change the program source (by adding functionalities for example) or take a piece of code of the program to use it in another program, then the changes must be GPLed. However, the data created with the tool itself aren''t bound to the GPL.

For example, if you create images with the GIMP, they don''t have to be free. Same goes with GCC, the trick is that the licence may be more confusing since the "data created with the tools" are executables resulting from source code compilation, hence the confusion between GCC source code and your applications source code.
Right, gcc itself won''t do anything as far the license I can use, but Gnu-created libraries made for use in Win32 might be either GPLed or LGPLed.

I guess that is something that I might want to look into as well B-)
-------------------------GBGames' Blog: An Indie Game Developer's Somewhat Interesting ThoughtsStaff Reviewer for Game Tunnel

This topic is closed to new replies.

Advertisement