From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fcbbb6164185a4a7 X-Google-Attributes: gid103376,public From: jerry@jvdsys.nextjk.stuyts.nl (Jerry van Dijk) Subject: Re: linking with C++ Date: 1998/04/21 Message-ID: #1/1 X-Deja-AN: 346456284 References: <6hglkj$dlh$1@nyheter.chalmers.se> Organization: * JerryWare *, Leiden, Holland Newsgroups: comp.lang.ada Date: 1998-04-21T00:00:00+00:00 List-Id: Martin Klang (md4mars@mdstud.chalmers.se) wrote: : lately i've been trying out ADA, and even though it's not by a long way as : esthetically pleasing as C++, i must confess it's a pretty useful little : language. You just brightened up my day :-) : i cannot link to C++ with gnatlink. Well, actually your code says: : //file cstuff.c : #include : void c_test() : { : printf("jah!"); : } which is not C++ but C code. So instead of: : pragma Import(CPP,C_Test,"c_test"); use pragma Import(C, C_Test, "c_test); and build with gcc -c cstuff.c gnatmake test -largs cstuff.o BTW remember that gcc is just a driver program, and the '.c' extension will make it use the C, not the C++ compiler. The same goes for g++. BTW2 remember that there might already be a program called 'test' in your path. To try out linking to C++ use a // file cppstuff.cc #include void cppstuff() { cout << "jah!" << endl; } with the CPP import. And do not forget to link in libstdc++. Jerry. -- -- Jerry van Dijk | email: jdijk@acm.org -- Leiden, Holland | member Team-Ada