problem with makefile
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > problem with makefile




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    problem with makefile  
ferbar


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-28-07 06: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)






[ Post a follow-up to this message ]



    Re: problem with makefile  
Paul Pluzhnikov


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-28-07 06: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.





[ Post a follow-up to this message ]



    Re: problem with makefile  
Jens Thoms Toerring


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-28-07 06: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
[vbcol=seagreen]
> 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[/vbc
ol]
^^

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





[ Post a follow-up to this message ]



    Re: problem with makefile  
ferbar


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
02-28-07 06: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!!






[ Post a follow-up to this message ]



    Re: problem with makefile  
Fred Kleinschmidt


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-01-07 12:17 AM


"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







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:02 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register