Don't list hello2.c in the file, as it will get linked in twice. (The
cdef extern from creates an #include for you.) You don't want a main
in there either. Also, for hello2.c, you need #include not #import.
On 12/23/10 12:52 PM, Tom Elliott wrote:
> OK, I fixed my silly error with #include and changed sourcefiles, but
> I still get the same error.
It's a warning, not an error, does the resulting executable work?
> void f() {
> printf("%s", "Hello world!\n");
> }
> In file included from hello2_caller.c:219:
> hello2.c:3: warning: function declaration isn�t a prototype
In modern C, the compiler expects both a declaration and a prototype.
Traditionally, the prototype goes in the *.h file, and the function
declaration itself goes in the *.c file.
however, I'm not getting the warning on my system (OS-X 10.6, gcc 4.2, I
think).
but you might try adding a prototype to make the compiler happy:
hello2.c:
#include <stdio.h>
void f();
void f() {
printf("%s", "Hello world!\n");
}
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Could you try this:?
#include <stdio.h>
void f(void);
void f(void) {
printf("%s", "Hello world!\n");
}
f() and f(void) are not the same thing in C, f(void) is likely the one you want.
--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169