LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-25-2013, 05:49 AM   #1
dexterous.me82
LQ Newbie
 
Registered: Jul 2013
Posts: 7

Rep: Reputation: Disabled
Makefile not finding the include file


I Have a folder structure like this.

Gif_Utility

-> Makefile

-> include ( all .h files are over here)

-> Src ( all .c files are over here).

I am writing a makefile.

Makefile

VPATH = src:include
INC = -I ./include

gif_objects = gif_display.o \
gif_lzw.o \
gif_read.o \
sysm.o \
x86_main.o


gif_display.0 : gif_display.c
gcc -I /export/home/joshis1/MakeTutorial/GIF_Utility/include -c $<

#gif_lzw.0 : gif_lzw.c
# gcc $(INC) -c src/gif_lzw.c

#gif_read.0 : gif_read.c
# gcc -I ./include/ -c $<

#sysm_main.0 : sysm_main.c
# gcc -I ./include/ -c $<

#x86_main.0 : x86_main.c
# gcc -I ./include/ -c $<


On command prompt:
$ make gif_display.o

cc -c -o gif_display.o src/gif_display.c
src/gif_display.c:2:17: fatal error: sysm.h: No such file or directory
compilation terminated.
make: *** [gif_display.o] Error 1

On the other hand, If i do like this it compiles fine $make -> this creates the gif_display.o

I don't know why it is throwing error on specifying the rule. Am I missing something, please help.

I am using Ubuntu machine to build my code.
 
Old 08-25-2013, 11:20 AM   #2
PECONET009
Member
 
Registered: Sep 2006
Location: Finland.
Distribution: kali linux.
Posts: 156

Rep: Reputation: 21
Lightbulb More info on Makefiles..

Quote:
Originally Posted by dexterous.me82 View Post
I Have a folder structure like this.

Gif_Utility

-> Makefile

-> include ( all .h files are over here)

-> Src ( all .c files are over here).

I am writing a makefile.

Makefile

VPATH = src:include
INC = -I ./include

gif_objects = gif_display.o \
gif_lzw.o \
gif_read.o \
sysm.o \
x86_main.o


gif_display.0 : gif_display.c
gcc -I /export/home/joshis1/MakeTutorial/GIF_Utility/include -c $<

#gif_lzw.0 : gif_lzw.c
# gcc $(INC) -c src/gif_lzw.c

#gif_read.0 : gif_read.c
# gcc -I ./include/ -c $<

#sysm_main.0 : sysm_main.c
# gcc -I ./include/ -c $<

#x86_main.0 : x86_main.c
# gcc -I ./include/ -c $<


On command prompt:
$ make gif_display.o

cc -c -o gif_display.o src/gif_display.c
src/gif_display.c:2:17: fatal error: sysm.h: No such file or directory
compilation terminated.
make: *** [gif_display.o] Error 1

On the other hand, If i do like this it compiles fine $make -> this creates the gif_display.o

I don't know why it is throwing error on specifying the rule. Am I missing something, please help.

I am using Ubuntu machine to build my code.

More info on Makefiles:

http://mrbook.org/tutorials/make/
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how to include a file after updating in makefile k_element Linux - Newbie 1 04-17-2012 06:04 AM
How to include my helloworld.c into makefile? dennisdd Linux - Newbie 7 10-19-2011 03:39 AM
Makefile include statement problem wampire Programming 1 05-21-2008 10:32 PM
Bristol 10.4 configure not finding JACK,ALSA, or "X11 include file" on Ubuntu studio scwerllguy Linux - Software 7 06-03-2007 04:43 PM
Unable to include headers in Makefile Raphexion Programming 2 11-05-2005 08:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration