Quote:
Originally Posted by queency
I am using wx/wx.h, sqlite3.h, stdlib.h, stdio.h header files and
I cannot link after compiling because i don't know the .so files
that this headers belong to.
gcc -c <mySource> works fine but gcc <mySource> doesn't
|
Well, things like stdlib.h and stdio.h are part of your libc (which is automatically linked to by gcc). Things like iostream are part of stdlibc++ (which is automatically linked to by g++). Other headers always come with respective libraries (that’s how you get them in the first place).
For example, sqlite3.h is comes from
sqlite. When you installed it, it probably created a symlink (such as /usr/lib/libsqlite3.so) to the real library (in this case, you link with “-lsqlite3”). If you forgot what it was, you can always ask your package manager (assuming you got it from a package repository). Otherwise (if you compiled from source), you can look at the sourcetree (if you kept it around). Otherwise (supposing you compiled with pkg-config enabled), you can use pkg-config.
Other packages are more complicated and might require more libraries. Additionally, there is some cross-platformness associated with them. For example wxWidgets (when run with a gtk backend) has about 10 separate libraries. The libraries might be different if you use the Windows backend. In that case, you use the provided pkg-config wrapper (you could use pkg-config directly, but it might not be portable). For wxWidgets, it’s called wx-config.
So the “best” way to compile your example program is:
Code:
gcc `pkg-config --cflags --libs sqlite3` `wx-config --cflags --libs` -o myExecutable <mySource>