Fedora Linux Support Community & Resources Center
  #1  
Old 19th September 2012, 05:18 PM
Tidey Offline
Registered User
 
Join Date: Aug 2012
Location: Puerto Rico
Posts: 4
linuxfirefox
[solved] Makefile not creating .o for a dependency

Hello there,

I've been searching to see if I can find an issue to this problem but so far I haven't found anything that really helps.

I was making changes to one of the .h files of my project, nothing big simply commenting some unnecessary lines. When I tried running the makefile again, it updated all modules except for that one (security.h). I went ahead and added a 'clean' in efforts to force the makefile to make everything again.

Since then I've been getting the following error:

Code:
[Kalico@Kalico Modular_Prog]$ make
gcc -c main.c
gcc -c user.c
gcc -c menu.c
gcc -c security.h
gcc -o main main.o user.o menu.o security.o
gcc: error: security.o: No such file or directory
make: *** [main] Error 1
[Kalico@Kalico Modular_Prog]$
As the error says, security.o isn't created. In it's place I have security.gch.

I'm not certain why exactly it's causing this error, the first time I ran the makefile it compiled everything perfectly and I didn't change any lines, simply added the clean command.

Code:
# Makefile for the main application

main: main.o user.o menu.o security.o
        gcc -o main main.o user.o menu.o security.o

main.o: main.c user.h menu.h security.h
        gcc -c main.c

user.o: user.c user.h
        gcc -c user.c

menu.o: menu.c menu.h
        gcc -c menu.c

security.o: security.c security.h
        gcc -c security.h

clean:
        \rm *.o                                         
"makefile" 19L, 325C
Any insight is appreciated. Thanks!

Last edited by Tidey; 19th September 2012 at 05:42 PM.
Reply With Quote
  #2  
Old 19th September 2012, 05:42 PM
stevea Online
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,911
linuxfirefox
Re: Makefile not creating .o for a dependency

This command in your makefile is not right
gcc -c security.h

You probably want

gcc -c security.c

---------- Post added at 12:42 PM ---------- Previous post was at 12:38 PM ----------

Actually your entire makefile would be better off using the default rules like ....

Code:
# Makefile for the main application
main: user.o menu.o security.o

main.o: user.h menu.h security.h
user.o: user.h
menu.o: menu.h
security.o: security.h

clean:
	\rm *.o
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe

Last edited by stevea; 19th September 2012 at 05:51 PM.
Reply With Quote
Reply

Tags
creating, dependency, makefile

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
% in makefile daviddoria Using Fedora 3 23rd April 2008 01:37 AM
Makefile saicharantej Using Fedora 1 18th April 2008 02:24 PM
Makefile??? bradley Using Fedora 15 23rd January 2008 11:12 AM
Makefile??? disasterpiece12 Hardware & Laptops 1 20th July 2006 08:58 AM


Current GMT-time: 00:38 (Thursday, 23-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Eirunepe - Tukwila Photos on Instagram - Morar Photos