You might want to try prototyping the C funct. BEFORE it is called.
This worked for me when I had the same probs.



At 6:08 AM -0700 4/9/99, John wrote:
>I have been trying for a couple of weeks now to compile a program that
>consists of a C++ main function which calls a C function. I have tried
>using the -c option to compile object code for both files using gcc and
>g++, then linking them together (I've trued using both gcc and g++ to
>link the object code). However when I try the final link together I get
>an error saying that there was an undefined reference to the C function
>in the main function.
>
>Here is the test code I have been using (I know there is no reason why
>I can't compile them both as C or C++ but they are not the functions I
>need to compile, only test ones. It makes sense to me. The final code I
>create will involve RPC calls which I can only get working in C)
>
>//C++ main function called main.cc
>extern void funky(void);
>
>void main()
>{
>  funky();
>};
>
>//C function called funky.c
>void funky()
>{
>  int x;
>  x = 0;
>};
>
>
>The commands I used were
>g++ -c main.cc
>gcc -c funky.c
>g++ main.o funky.o -o prog
>
>I am sorry to bother you with this question but I don't know who else
>to try, even my leactures at university don't know how to achieve this.
>--
>John, My reality check just bounced.


****** PLEASE NOTE *******
OUR NEW ADDRESS AND TELEPHONE NUMBER:

SplitInfinity
13553 Poway Rd. #1504
Poway, CA 92064
U.S.A.

OUR NEW PHONE NUMBER: 619-679-2814

All items should be mailed to this address from this moment forward.

Thank you.

Chris Jester
SplitInfinity




Reply via email to