Newbie question about compilation

Andre Kirchner sieg1974@yahoo.com
Fri Sep 12 21:45:00 GMT 2003


Hi,

how can I compile a program that is divided in many .h
and .c files?
I have done this program divided in these files

dutils.h:

# include <stdio.h>
int makeDir();

dutils.c:

# include "dutils.h"

int makeDir()
{
	printf( "worked\n" );
	return( 1 );
}

main.c:

# include "dutils.h"

int main()
{
	makeDir();
	return( 0 );
}

But when I try to compile it I got this error message

[andre@Deutschland asp2]$ gcc ./main.c -o ./main.out
/tmp/ccIA1jr7.o(.text+0x11): In function `main':
: undefined reference to `makeDir'
collect2: ld returned 1 exit status

Thanks,

Andre

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



More information about the Gcc-help mailing list