|
Home > Archive > Unix Programming > February 2007 > problem with makefile
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
problem with makefile
|
|
| ferbar 2007-02-28, 1:17 pm |
| Hi,
I'm trying to create a makefile for a program.. but I'm getting an
error message when the compiler tries to link everything together..
Here's the make file and file structure:
btw, the code uses log function.. could that be the problem? yet I
dont see that particular error..
Thanks a lot for your help.
-fbm
-----
all: simul
simul: dllist.o random_functions.o event_functions.o main.o
gcc -c dllist.o random_functions.o event_functions.o main.o -o simul
dllist.o: dllist.c dllist.h
gcc -c dllist.c
random_functions.o: random_functions.c random_functions.h
gcc -c random_functions.c
event_functions.o: event_functions.c event_functions.h
gcc -c event_functions.c
main.o: main.c main.h
gcc -c main.c
clean:
rm -rf *o simul
-----
Now, the error I get is the following:
$ make clean
rm -rf *o simul
Fernando@FERLAPTOP ~/CSC579/simul1
$ make all
gcc -c dllist.c
gcc -c random_functions.c
gcc -c event_functions.c
gcc -c main.c
main.c: In function `main':
main.c:7: warning: passing arg 2 of `gettimeofday' from incompatible
pointer type
main.c:99: warning: passing arg 2 of `gettimeofday' from incompatible
pointer type
gcc -c dllist.o random_functions.o event_functions.o main.o -o simul
gcc: dllist.o: linker input file unused because linking not done
gcc: random_functions.o: linker input file unused because linking not
done
gcc: event_functions.o: linker input file unused because linking not
done
gcc: main.o: linker input file unused because linking not done
gcc: dllist.o: linker input file unused because linking not done
The warnings are fine, since this is cygwin complaining.. it compiles
fine in a linux machine. Now, the dependency relationship of the files
is the following..
-main.c headers:
#include "main.h"
-main.h headers:
#include "dllist.h"
#include "event_functions.h"
-event_functions.c headers:
#include "event_functions.h"
-event_functions.h headers:
#include "dllist.h"
#include "random_functions.h"
- random_functions.c headers
#include "random_functions.h"
-random_functions.h headers
(none)
-dllist.c headers:
#include "dllist.h"
-dllist.h headers:
(none)
| |
| Paul Pluzhnikov 2007-02-28, 1:17 pm |
| "ferbar" <fbarsoba@gmail.com> writes:
> simul: dllist.o random_functions.o event_functions.o main.o
> gcc -c dllist.o random_functions.o event_functions.o main.o -o simul
Read 'info gcc' to find out what '-c' flag means, and to understand
why it should *not* be used on the above line.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
| |
| Jens Thoms Toerring 2007-02-28, 1:17 pm |
| ferbar <fbarsoba@gmail.com> wrote:
> I'm trying to create a makefile for a program.. but I'm getting an
> error message when the compiler tries to link everything together..
> Here's the make file and file structure:
> btw, the code uses log function.. could that be the problem? yet I
> dont see that particular error..
> Thanks a lot for your help.
> -fbm
> -----
> all: simul
> simul: dllist.o random_functions.o event_functions.o main.o
> gcc -c dllist.o random_functions.o event_functions.o main.o -o simul
^^
Here you tell gcc _not_ to link. But obviously you want to link here
and not just compile, so remove the '-c' and you should be fine.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
| |
| ferbar 2007-02-28, 1:17 pm |
| On Feb 28, 12:02 pm, j...@toerring.de (Jens Thoms Toerring) wrote:
> ferbar <fbars...@gmail.com> wrote:
>
> ^^
>
> Here you tell gcc _not_ to link. But obviously you want to link here
> and not just compile, so remove the '-c' and you should be fine.
>
> Regards, Jens
> --
> \ Jens Thoms Toerring ___ j...@toerring.de
> \__________________________ http://toerring.de
Silly thing. I am sorry for the dumb error... Thanks a lot!!
| |
| Fred Kleinschmidt 2007-02-28, 7:17 pm |
|
"ferbar" <fbarsoba@gmail.com> wrote in message
news:1172681444.077238.232980@v33g2000cwv.googlegroups.com...
> <snip>
>
> Fernando@FERLAPTOP ~/CSC579/simul1
> $ make all
> gcc -c dllist.c
> gcc -c random_functions.c
> gcc -c event_functions.c
> gcc -c main.c
> main.c: In function `main':
> main.c:7: warning: passing arg 2 of `gettimeofday' from incompatible
> pointer type
> main.c:99: warning: passing arg 2 of `gettimeofday' from incompatible
> pointer type
><snip>>
> The warnings are fine, since this is cygwin complaining.. it compiles
> fine in a linux machine.
The warnings are definitely NOT fine. They are telling you that
your code is messed up. You are passing the wrong type of
variable to gettimeofday.
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Aero Stability and Controls Computing
|
|
|
|
|