Ahhh, ok...I didn't know that I shouldn't pass headers to the makefile. But wait! If I don't, and I have an error in a header file, will it find it when it's compiling just because it's included in another file that's explicitly being compiled?
Ahhhhhhhhh. Yeah, I just kind of compile it with gdb variables so they're there on the rare occasion that I need to use them.
I'm not sure about how big SFML libs are, but they could be huge. Good point.
So, for gits and shiggles I tried compiling with a few different things and looking at the sizes. Here is the simplest, not compiling the header files and no -ggdb:
$ g++ -o DispLatticeRun dispLattice.cpp -Wall -lsfml-graphics -lsfml-window -lsfml-system
This only produces the executable DispLatticeRun and it is 72 kB.
Running with -ggdb:
$ g++ -o DispLatticeRun dispLattice.cpp -Wall -lsfml-graphics -lsfml-window -lsfml-system -ggdb
Produces just DispLatticeRun again but it is 215 kB.
Now, compiling them all, without -ggdb:
1 2
|
$ g++ -c dispLattice.cpp Point.h Point3d.h Layer3d.h Grid.h
$ g++ -o DispLatticeRun dispLattice.o -lsfml-graphics -lsfml-window -lsfml-system
| |
This produces all these .gch files that are so large:
1 2 3 4 5
|
$ ls -sh
total 34M
4.0K dispLattice.cpp 4.0K Grid.h 14M Layer3d.h.gch 4.0K pix 4.0K Point.h
160K dispLattice.o 13M Grid.h.gch 4.0K makefile 4.0K Point3d.h 1.8M Point.h.gch
72K DispLatticeRun 4.0K Layer3d.h 4.0K oldfiles 5.5M Point3d.h.gch
| |
If I do the same, but with the -ggdb flag:
1 2
|
$ g++ -c dispLattice.cpp Point.h Point3d.h Layer3d.h Grid.h -ggdb
$ g++ -o DispLatticeRun dispLattice.o -lsfml-graphics -lsfml-window -lsfml-system
| |
I also get enormous files, but they're slightly larger:
1 2 3 4 5
|
$ ls -sh
total 37M
4.0K dispLattice.cpp 4.0K Grid.h 15M Layer3d.h.gch 4.0K pix 4.0K Point.h
464K dispLattice.o 15M Grid.h.gch 4.0K makefile 4.0K Point3d.h 1.8M Point.h.gch
216K DispLatticeRun 4.0K Layer3d.h 4.0K oldfiles 5.9M Point3d.h.gch
| |
So it looks like the real culprit is compiling the header files. But why are they so large? The main file is much larger than any of them but only compiles to be about 400kB.