473,799 Members | 3,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what is the meaning of the Warning message,why it occurs?

i have 5 files,when i use make command to compile them a error occurs
"make: Warning: Infinite loop: Target `c.o' depends on itself"

when i type make an warning message occurs

cc -c b.c
cc -c a.c
make: Warning: Infinite loop: Target `c.o' depends on itself
cc -c c.c
cc b.o a.o c.o -o a
1. file :c.c
#include <stdio.h>
void print(){
printf("%d",1);
}

2. file : c.h
#ifndef t
#define t
#include <stdio.h>

void print();
#endif

3. file : b.c
#include "c.h"
void print2(){
printf("%d",2);
}

4. file : b.h
void print2();

5. file : a.c
#include "b.h"
#include "c.h"
extern int h;
int main(){
print();
print2();
return 0;

}

the makefile
a: b.o a.o c.o b.h c.h
cc b.o a.o c.o -o a
b.o: b.c b.h
cc -c b.c
c.o: c.o c.h
cc -c c.c

thanks!
Nov 15 '05 #1
3 2054
nick wrote:
i have 5 files,when i use make command to compile them a error occurs
"make: Warning: Infinite loop: Target `c.o' depends on itself"
<snip>

This is not a C-specific question, you're having trouble writing makefiles.
c.o: c.o c.h


You want c.c in the dependency list, not c.o.

S.
Nov 15 '05 #2
>i have 5 files,when i use make command to compile them a error occurs
"make: Warning: Infinite loop: Target `c.o' depends on itself"
Because c.o *DOES* depend on itself.
c.o: c.o c.h
See that c.o on BOTH sides of the dependency? That's a mistake.

Gordon L. Burditt

when i type make an warning message occurs

cc -c b.c
cc -c a.c
make: Warning: Infinite loop: Target `c.o' depends on itself
cc -c c.c
cc b.o a.o c.o -o a
1. file :c.c
#include <stdio.h>
void print(){
printf("%d",1) ;
}

2. file : c.h
#ifndef t
#define t
#include <stdio.h>

void print();
#endif

3. file : b.c
#include "c.h"
void print2(){
printf("%d",2) ;
}

4. file : b.h
void print2();

5. file : a.c
#include "b.h"
#include "c.h"
extern int h;
int main(){
print();
print2();
return 0;

}

the makefile
a: b.o a.o c.o b.h c.h
cc b.o a.o c.o -o a
b.o: b.c b.h
cc -c b.c
c.o: c.o c.h
cc -c c.c

thanks!

Nov 15 '05 #3
nick wrote:
i have 5 files,when i use make command to compile them a error occurs
"make: Warning: Infinite loop: Target `c.o' depends on itself"

when i type make an warning message occurs

cc -c b.c
cc -c a.c
make: Warning: Infinite loop: Target `c.o' depends on itself
cc -c c.c
cc b.o a.o c.o -o a

[snip.c files] the makefile
a: b.o a.o c.o b.h c.h
cc b.o a.o c.o -o a
b.o: b.c b.h
cc -c b.c
c.o: c.o c.h
Why do you have c.o on both the sides ? Remove the one on the right and
your warning should disappear. OT here though, nothing to do with c
language.
cc -c c.c

thanks!


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1845
by: Mechain Marc | last post by:
In one of my logfiles I have quite repeatedly the following message: InnoDB: Warning: using a partial-field key prefix in search What does this warning mean ? Regards, Marc Mechain Atos Origin
7
1996
by: chand | last post by:
Hi., In my api.py file 'g_opt_list' is defined globally g_opt_list =,,,,,,] I am using this global list in the fucntion def function (): gloabl g_opt_list
15
2630
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I'm trying to initialize an array of error messages, so that I can print out an error message by using the 'nth string in an array, e.g. printf("%s\n", messages); I'm still hazy on arrays of pointers to strings, so you may want to finish your drinks before examining my code. Here's a small sample program. #include <stdio.h>
4
4122
by: bingfeng | last post by:
I have some codes generated by perl, in which initialize some huge struct,such as PARA TOS_network_spantree_set_0_para_0 = { "vlan", emNUM, NULL, "", "configuration on a designated vlan", PRO_REQUIRED }; const char* TOS_network_spantree_set_0_para_1_emvalue = { "disable", "enable", NULL }; PARA TOS_network_spantree_set_0_para_1 = { "", emENUM, TOS_network_spantree_set_0_para_1_emvalue, "", "enable or disable STP", PRO_REQUIRED };
2
34588
by: nick | last post by:
the following is my programming code and compile message why the warning message arise, have i done somethings wrong? #include<stdio.h> typedef struct card{ int abc; }card;
132
4668
by: Frederick Gotham | last post by:
If we look at a programming language such as C++: When an updated Standard comes out, everyone adopts it and abandons the previous one. It seems though that things aren't so clear-cut in the C community. It would seem that C99 is the most up-to-date Standard, but far more people seem to be working off the C89 Standard. Could someone please explain to me why this is so? --
65
3617
by: Aditya | last post by:
Hi I am using a line of as char recvedValues = {'\0'}; in my code. I get a warning as near initialization for recvedValues. I am using gcc 3.4 Can anybody please explain the meaning. Thanks Aditya
21
8381
by: Sebastian Faust | last post by:
Hi, Unfortunately, I don't find lots of information on this warning. It occurs if I compile with -pedantic but I am not sure how I can resolve this problem. Do you have an idea? The following code produces the warning: const static unsigned long long data = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL}
46
2154
by: Kenny O'Clock | last post by:
This came up in a job interview, what is the output of the program below? I tried to compile and run it myself, but my compiler (lcc-win32) aborts with this errors.... Warning test2.c: 3 old-style function definition for 'main' Warning test2.c: 3 missing prototype for 'main' Warning test2.c: 3 ' Error test2.c: 3 compiler error in d:\lcc\mc71\types.c--assertion failure at line 868 Error c:\test\test2.c 3 Compiler error (trap)....
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10491
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10268
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10031
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9079
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.