"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > hi i am using g++ on windows and trying to learn c,c++.. > i was trying to make and use user defined libraries and wrote > > tom.h > --------- > void mylibfn(void); > > tom.c > -------- > void mylibfn(){
Preferred way to say the same thing: void mylibfn(void) { [Yes, placement of the '{' matters under certain conditions.] > printf("my libfn called!\n"); > } > > then i made tom.o by > g++ -c tom.c > > and using ar qv libfruit.a tom.o i created libfruit.a So far everything is all right ... Note that mylibfn() has 'C++' linkage, and is not callable from straight-'C' code. > > i wish to call the mylibfn() from another test.c like > test.c > -------- This is missing '#include "tom.h"' > int main(){ > mylibfn(); > } > > how do i compile test.c using g++ ,giving the libfruit.a as argument ? g++ test.c -L... -lfruit > for the cc compiler it is something like > cc test.c -lfruit -L/home/sharedlib .. but i am bit confused by g++ > options.. g++ generally takes the same options. There are a lot of additional options, but you don't need them for "basic" stuff. Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus