[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help in linking
From: |
Paul Pluzhnikov |
Subject: |
Re: help in linking |
Date: |
Wed, 11 Apr 2007 22:01:05 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
"amit.hetawal@gmail.com" <amit.hetawal@gmail.com> writes:
> I am just having lot of trouble in compiling stuff on my MACOSX but
^^^^^^^^^
You have trouble compiling, but your subject line says "help with
linking". Do you not understand the difference between compiling
and linking, or are you just sloppy in expressing your questions?
> I have tried changing the compiler to g++
It *already* is set to g++ in your makefile.
> and using the -lstdc++ flag
Never do that. If you link with g++ (as you should for any C++
code), that library is added automatically. Besides, it can't
possibly help in *compiling*.
> but every time it gives me an error
> coral_test.c: In function 'void removeall(htab*)':
> hashtab.h:162: error: too many arguments to function 'word hfirst()'
This tells me that hashtab.h does not have proper declaration
of hfisrt(). It has an old K&R C-style prototype, which is not
compatible with C++.
> What should i used here.
You should fix hashtab.h to be valid C++, or compile with 'gcc',
if you don't want to convert your code into C++.
There are a couple of ways to fix hashtab.h:
- add correct ANSI prototype for hfirst():
word hfirst(type_of_param1, type_of_param2, ...etc);
(better).
- wrap K&R prototypes in 'extern "C" { ... }'
(worse, but the only choice if you can't modify hashtab.h)
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.