Mich Paw schrieb:
> My .exe file weight about 1MB, even, that it has less, than 100 lines
> of code. So I thought, that it add some dlls inside.
Your program just has much more than 100 lines of code, but you don't
see them. You included libraries and used them, so you added some code
of the libraries to your program, at least a call to dll code. How much
it gets in the end depends of usage and kind of libraries, but a
graphical user interface finally needs a lot of code.
You could try different versions of "hello world" program and change the
kind of output, to get a feeling for "injected code".
#include <stdio.h> => printf("Hello World");
#include <iostream.h> => std::cout << "Hello World" << endl;
And finally the FLTK, which shows a window and needs lots of code for that.
> I'd like to have small exe file
To shrink the exe file a lot, you can strip the symbols by usage of the
linker flag '-s':
g++ -s -o "test.exe" test_cpp.o
This should create a noticiable shorter exe file. But be aware, not to
use '-s' for debugging mode, because this will disable debugging.
Anyway you should take care of the compiler flags for optimization and
debug - to get a short exe you need to optimize and to disable debug.
>, and to run it, I'd like to insert in the same
> directory dlls, which will be need to run it.
I like to static link required libraries. This way the program doesn't
depend on a directory or some kind of installation, but can be started
anywhere.
The FLTK in fact normally is static linked and part of your program, but
you also could link your program to a FLTK dll. This saves space, when
more than one FLTK program is in use, but there also are disadvantages,
e.g. dll must be installed and in search path.
> I've read, that if I contain dlls inside of exe file, I
> will not be able, to sell my program (LGPL Licence). I don't know the
> law, so maybe I'm wrong.
In brief - LGPL means, you can static link it to your program and sell
your program without restrictions, GPL means, you can static link it to
your program and sell your program, but your program now also is GPL and
you need to publish the source code. So you can static link FLTK without
restrictions, but when linking some other library you need to take care
about the licence of the library.