building and distributing in Linux

Hi all
I'm posting as I am just moving from windows only programming using msvc++ to linux. I've tried the Kdevelop and Eclipse IDEs and can get basic projects to compile and execute but i have some questions about larger more complicated projects relating to distribution.

On windows if I wanted a colleague to be able to run a program I'd written I just linked it statically - there was a single option to do this in MSVC++. This meant that all libraries needed were included in the executable (both the standard C++ ones and any of my own) so I could just send them this file which they could double click. On Linix I think things are a bit different. I can't find a statically link option in either of the IDEs and I'm not sure that passing binaries around is the best option as some searching indicated they might not work on other distros. I could hapilly package things up as a source tarball but I'm not sure how to do this. KDevelop claims to do this for me but I think this feature is no longer supported and the resulting tarball will not ./configure.

Any guidance much appreciated.

Phil
To create a full source distribution you can use the GNU autotools which will generate all the scripts required to configure and build your program.

To link statically to the libraries you have to use the GCC option -static.
For the standard libraries you have -static-libgcc and -static-libstdc++
http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options
Thanks Bazzy, that's given me at least a starting point for checking stuff out myself
You will probably find that your personal libraries are statically linked
unless you specify them as shared objects.

You won't need to include any standard libraries in a *nix system
because they'll all be there. generally.

Binaries should work between distros, unless you try to run 64 bit on 32 bit.
If you are using esoteric libraries that may not be installed then they will
get link errors. If you are using std libc/C++ type stuff you'll be ok.


just try it first and come back with any problems.
There may be problems if you use a different library version than the target OS default one
Topic archived. No new replies allowed.