avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] HowTo split a program into several files ?


From: Vincent Trouilliez
Subject: Re: [avr-chat] HowTo split a program into several files ?
Date: Mon, 12 Sep 2005 19:33:27 +0200

> Or you can tell  the compiler to directly compile and link seperate source 
> files by just 
> feeding them all into gcc at once (gcc -o foo main.c foo.c morefiles.c ...) .
> 
> In your example above you'd write a file named foo.h containing prototypes of 
> all functions you placed in foo.c and then include foo.h in both, your main 
> source file and foo.c (you include foo.h in foo.c to make sure, that the 
> compiler complains if you made a mistake writing your prototypes).
> 
> Ciao,
>   Till


Thanks Till, I tried that, but the compiler complains that my lcd.c (not
'foo', but lcd.. ;-) uses undeclared functions and defines, despite in
main.c (let's call the main C source file this way, I took care to
include my lcd.h statement UNDER all other usual includes.


main.c :
-------
#include <stdio.h>
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
#include <avr/delay.h>

#include "lcd.h"    <----------- my file with LCD related routines
(well, only the prototyptes of course)



Am I supposed to copy all the "regular" includes at the top of lcd.h as
well ?




Regards,


--
Vince, almost there...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]