Using C++ / Java to develop software for commercial purpose

gpllicensing

I'm planning to develop a program which I intend to sell later. I'm trying to decide upon a language to code it with, and have narrowed down to C++ or Java.

I've been through the GPL v2 and v3 licenses used for GNU's GCC and OpenJDK (yes, I can understand some amount of legal stuff, but clearly, not all of it). But there is one point upon which everyone is obscure (this should have been one of the first things answered, IMO): if I develop a program using C++/Java and compile it using GCC compiler or OpenJDK's compiler, can I sell it without having to place my program under GPL as well?

As far as I can make out, I have full rights to assign any license to my program, but, there is a catch: it says in the license that I shouldn't link to any library that is under GPL. If so, I'll have to release my program under GPL.

Now, I don't know what in C++/Java is considered a library, so if I use the normal stuff in C++ (iostream, list, map, etc. ) or the normal Java classes/interfaces available as part of the standard JDK 6 distribution (String, List, Map, etc.), does this constitute 'linking to the libraries'?

Best Answer

if I develop a program using C++/Java and compile it using GCC compiler or OpenJDK's compiler, can I sell it without having to place my program under GPL as well?

Yes. The GPL specifically excludes the output of running the program:

the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program).

which means that if you include bits of GCC or something else GPLed in your program, then yes it would have to be GPLed, otherwise no - the fact that its object code was produced by a GPLed compiler is not relevant to whether it should be GPLed.

All the standard language libraries you would link to are either not GPLed, or are GPLed but have a special exception to allow your proprietary software to link to them, if you do not modify them. In the case of C++ I mean libgcc, glibc and libstdc++; in the case of Java I mean all the libraries included in the JRE.

Technically, you can legally sell GPL software anyway, but almost no-one makes any money out of doing so.