I have a program containing only one file: main.cpp. I copied there a few lines of code from LGPL licensed file (from an LGPL licensed library).

What copyright notice should I put at the top of my main.cpp? Does LGPL notice still makes sense considering the derivative work (main.cpp) is not a part of any library and is not used to produce a library? Should it be GPL notice?

Copyright notice from the file where a few lines of code were copied from:

* ------ copyright holders -------------- * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */

1 Answer 1


When you use LGPL code, you may use it under either the LGPL or the GPL, at your choice. This is because the LGPL is the same as the GPL plus some extra permissions. You can always decline those extra permissions and use the more restrictive GPL instead. You can't go the other way and add extra permissions to a work you don't own the rights to. Therefore, the combination of an LGPL work with a GPL work has to be licensed under the GPL.

Whether you prefer more permissive licenses or more viral licenses is up to you. However, using the LGPL for an application (not a library) only makes sense if you expect some parts of it to be reused later in a library and are fine with that library being LGPL.

Note that if you keep the LGPL code in a separate library and abide by the terms of the LGPL, then you do not need to use the GPL or LGPL for your application, and may instead use any license of your choice or even no license at all.

  • @Zimmi48 Thank you for your edit, but I think “viral license” is a better description than “license with strong copyright”. No license weakens copyright. And I don't think “viral” has a negative connotation nowadays. I think this describes the GPL rather well: it spreads to any code that directly touches the GPL code. There are more unkind descriptions of the GPL (“Linux is a cancer”) where I'd understood if you had edited them away…
    – amon
    May 12, 2017 at 14:11
  • 1
    I'm sorry for my failed attempt at improving your answer. I meant "license with strong copyleft". You will find plenty of people on this site who disapprove the use of the viral term, especially as it has caused prejudice to the GPL. However, I will leave the final decision to edit or not to you.
    – Zimm i48
    May 12, 2017 at 14:14
  • 3
    sigh... there is nothing VIRAL in copyleft licenses. This is not a disease. Please. There are conditions. They may be more or less extensive or onerous depending on your point of view. May 12, 2017 at 14:21
  • 1
    There are precise terms for this, weak/strong copyleft. Terms coming from unrelated fields as "viral" are less precise and contribute to inaccurate descriptions like "the GPL spreads to what it touches" instead of "the GPL spreads to derivative works". May 18, 2017 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.