Fedora Linux Support Community & Resources Center
Old 19th September 2012, 05:18 PM
Tidey Offline
Registered User
Join Date: Aug 2012
Location: Puerto Rico
Posts: 4
[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:

[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.

# 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

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

Last edited by Tidey; 19th September 2012 at 05:42 PM.
Reply With Quote
Old 19th September 2012, 05:42 PM
Posts: n/a
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 ....

# 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

	\rm *.o

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

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 12:12 PM
Makefile??? disasterpiece12 Hardware & Laptops 1 20th July 2006 08:58 AM

Current GMT-time: 10:16 (Sunday, 24-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

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