Archived

This topic is now archived and is closed to further replies.

GBGames

Compiling for Windows using GCC

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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 cetera
make all


Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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 !

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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-)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Intel has a "only for noncommercial" license for the free download of their C/C++ compiler. I belive that they also including all binaries generated with their tool in that license?
If not should it be legal to take the generated .o files and link them with mingw under Windows.

Intel is pretty generous against linux users giving away a limited premier support with free download whenever a updated version is avaliable. Everything is free.

Share this post


Link to post
Share on other sites