I know this isn't directly related to C++, but thought I'd ask anyway.
I've already read about 10 tutorials on makefiles, still have this
problem and hoping someone here could help me out. I'm creating a
project for my C++ class, it'll be tested on a UNIX system with cxx
compiler. Bellow I've pasted my current makefile for it:
------------------------------------------------------------------------
p1 : main.o DataManager.o EventList.o Event.o NameList.o Name.o
cxx -w0 -std strict_ansi main.o DataManager.o EventList.o Event.o
NameList.o Name.o -o p1
main.o : main.cpp DataManager.h Event.h Name.h
cxx -w0 -std srtict_ansi -c main.cpp
DataManager.o : DataManager.cpp DataManager.h Event.h Name.h EventList.h
cxx -w0 -std srtict_ansi -c DataManager.cpp
EventList.o : EventList.cpp EventList.h Event.h
cxx -w0 -std srtict_ansi -c EventList.cpp
Event.o : Event.cpp Event.h NameList.h
cxx -w0 -std srtict_ansi -c Event.cpp
NameList.o : NameList.cpp NameList.h Name.h
cxx -w0 -std srtict_ansi -c NameList.cpp
Name.o : Name.cpp Name.h
cxx -w0 -std srtict_ansi -c Name.cpp
------------------------------------------------------------------------
(By the way, if the tabs don't stay, just know that they are there at
every cxx line). So the way this works is, Name is no dependant on
anything, NameList is dependant on Name, Event is dependant on NameList,
and so on towards the top.
The problem that I'm having is that when I run make, I get an error
message saying that it doesn't know how to make Name.h. Basically it
takes the last dependency of the second label and gives me that error
message. This seems a little strange since I'm listing Name.h as a
dependency, not trying to make it. Any insight on what I'm doing wrong?
Never used makefiles before, so I'm sure there has to be something...
Thanks for any help. 12 1978
This is off-topic in this NG. However you might try to remove
all occurrences of .h files in your makefile, this should fix it.
HTH,
- J.
Jacek Dziedzic wrote: This is off-topic in this NG. However you might try to remove all occurrences of .h files in your makefile, this should fix it.
HTH, - J.
Thanks for that suggestion, but I already tried it right after posting
here. If I remove all .h files then it just complains about being unable
to make main.cpp.
Also, what newsgroup is best for this type of question?
Max wrote: Thanks for that suggestion, but I already tried it right after posting here. If I remove all .h files then it just complains about being unable to make main.cpp.
Daft thought, but you do know that unix is case sensitive right?
Also if cxx is anything like g++ then you need to specify the object name
when compiling or it will default to a.out which is probably not what you
want.
This this would be modified by adding a -oDataManager.o to the end of the
line starting <tab>cxx....
DataManager.o : DataManager.cpp DataManager.h Event.h Name.h EventList.h
cxx -w0 -std srtict_ansi -c DataManager.cpp
This is not your immediate problem but I thought it was worth mentioning.
Make bitching about not knowing how to make something that you have listed
as a dependency is usaually down to a typo in the name of the file.....
Also, what newsgroup is best for this type of question?
I would try comp.unix.programmer.
Regards, Dan.
--
** The email address *IS* valid, do NOT remove the spamblock
And on the evening of the first day the lord said...........
..... LX 1, GO!; and there was light.
Max wrote:
[snip] The problem that I'm having is that, when I run make, I get an error message saying that it doesn't know how to make Name.h.
make can't find Name.h
You misspelled it
or put it somewhere other than the directory where you invoked make.
Basically, it takes the last dependency of the second label and gives me that error message. This seems a little strange since I'm listing Name.h as a dependency, not trying to make it.
make can't find Name.h so it looks for a rule to make it.
Any insight on what I'm doing wrong? I never used makefiles before so I'm sure there has to be something...
E. Robert Tisdale wrote: Max wrote:
[snip]
The problem that I'm having is that, when I run make, I get an error message saying that it doesn't know how to make Name.h.
make can't find Name.h You misspelled it or put it somewhere other than the directory where you invoked make.
Basically, it takes the last dependency of the second label and gives me that error message. This seems a little strange since I'm listing Name.h as a dependency, not trying to make it.
make can't find Name.h so it looks for a rule to make it.
Any insight on what I'm doing wrong? I never used makefiles before so I'm sure there has to be something...
Here's the way my directory looks. As you can see all files are there
along with the makefile. I've already checked the spelling many times.
Still no luck :(
% ls
DataManager.cpp EventList.cpp Name.o main.cpp
DataManager.h EventList.h NameList.cpp main.o
DataManager.o EventList.o NameList.h my.output
Event.cpp Makefile NameList.o primary.input
Event.h Name.cpp a.out primary.output
Event.o Name.h cxx_repository
% make
.. Stop.n't know how to make Name.h
%
Btw, the .o files and a.out is what I got from just building the whole
thing manually. Make didn't generate those.
Dan Mills wrote: Max wrote:
Thanks for that suggestion, but I already tried it right after posting here. If I remove all .h files then it just complains about being unable to make main.cpp.
Daft thought, but you do know that unix is case sensitive right? Also if cxx is anything like g++ then you need to specify the object name when compiling or it will default to a.out which is probably not what you want.
This this would be modified by adding a -oDataManager.o to the end of the line starting <tab>cxx....
DataManager.o : DataManager.cpp DataManager.h Event.h Name.h EventList.h cxx -w0 -std srtict_ansi -c DataManager.cpp
This is not your immediate problem but I thought it was worth mentioning.
Make bitching about not knowing how to make something that you have listed as a dependency is usaually down to a typo in the name of the file.....
Also, what newsgroup is best for this type of question?
I would try comp.unix.programmer.
Regards, Dan.
All right, thanks. I'll try it there as well. But in the mean time, see
my reply to Robert. Don't think it's a typo and it's not due to letter
case either. Already checked all of that. As for a.out, the way I have
it right now is to build p1, but honestly if it gave me a.out I would be
very happy just as well. Just want it to give me something.
I don't know about the first CXX line... is there really a line feed at the
end or is it just line wrapping because
you put it in a post? If it is the former that may be confusing make... I
don't know about unix make but the
make programs I have seen need a '\' if you are going to do line
continuation on another line.
David
Max wrote: E. Robert Tisdale wrote: Max wrote:
[snip]
The problem that I'm having is that, when I run make, I get an error message saying that it doesn't know how to make Name.h.
make can't find Name.h You misspelled it or put it somewhere other than the directory where you invoked make.
Basically, it takes the last dependency of the second label and gives me that error message. This seems a little strange since I'm listing Name.h as a dependency, not trying to make it.
make can't find Name.h so it looks for a rule to make it.
Any insight on what I'm doing wrong? I never used makefiles before so I'm sure there has to be something...
Here's the way my directory looks. As you can see all files are there along with the makefile. I've already checked the spelling many times. Still no luck :(
% ls DataManager.cpp EventList.cpp Name.o main.cpp DataManager.h EventList.h NameList.cpp main.o DataManager.o EventList.o NameList.h my.output Event.cpp Makefile NameList.o primary.input Event.h Name.cpp a.out primary.output Event.o Name.h cxx_repository % make . Stop.n't know how to make Name.h %
Btw, the .o files and a.out is what I got from just building the whole thing manually. Make didn't generate those.
David Lindauer wrote: I don't know about the first CXX line... is there really a line feed at the end or is it just line wrapping because you put it in a post? If it is the former that may be confusing make... I don't know about unix make but the make programs I have seen need a '\' if you are going to do line continuation on another line.
David
No line feed there. Might just be your screen resolution. This does look
more like make doesn't recognize that Name.h is a file, but I have no
idea what I can do about it... I even tried specifying complete paths to
those files, not relative ones. Same story.
Well guys, after a long day of working on this thing I finally got it to
work... Apparently, until I put spaces at the end of every line, it
couldn't find a thing. Oh, and it also wouldn't run the last line of the
file until I put an extra line feed. Right about now I would like to
kill the person who came up with this idea, but at least I'm happy that
it works now.
Thanks for all your help :)
Max wrote: Here's the way my directory looks. As you can see all files are there along with the makefile. I've already checked the spelling many times. Still no luck :(
% ls DataManager.cpp EventList.cpp Name.o main.cpp DataManager.h EventList.h NameList.cpp main.o DataManager.o EventList.o NameList.h my.output Event.cpp Makefile NameList.o primary.input Event.h Name.cpp a.out primary.output Event.o Name.h cxx_repository % make . Stop.n't know how to make Name.h %
Btw, the .o files and a.out is what I got from just building the whole thing manually. Make didn't generate those.
ls -w 70
DataManager.cpp Event.h main.cpp Name.h
DataManager.h EventList.cpp Makefile NameList.cpp
Event.cpp EventList.h Name.cpp NameList.h expand Makefile
p1: main.o DataManager.o EventList.o Event.o \
NameList.o Name.o
g++ -Wall -ansi -pedantic \
main.o DataManager.o EventList.o Event.o NameList.o Name.o -o
p1
main.o: main.cpp DataManager.h Event.h Name.h
g++ -Wall -ansi -pedantic -c main.cpp
DataManager.o: DataManager.cpp DataManager.h Event.h Name.h \
EventList.h
g++ -Wall -ansi -pedantic -c DataManager.cpp
EventList.o: EventList.cpp EventList.h Event.h
g++ -Wall -ansi -pedantic -c EventList.cpp
Event.o: Event.cpp Event.h NameList.h
g++ -Wall -ansi -pedantic -c Event.cpp
NameList.o: NameList.cpp NameList.h Name.h
g++ -Wall -ansi -pedantic -c NameList.cpp
Name.o: Name.cpp Name.h
g++ -Wall -ansi -pedantic -c Name.cpp
clean:
rm -f p1 *.o
make
g++ -Wall -ansi -pedantic -c main.cpp
g++ -Wall -ansi -pedantic -c DataManager.cpp
g++ -Wall -ansi -pedantic -c EventList.cpp
g++ -Wall -ansi -pedantic -c Event.cpp
g++ -Wall -ansi -pedantic -c NameList.cpp
g++ -Wall -ansi -pedantic -c Name.cpp
g++ -Wall -ansi -pedantic \
main.o DataManager.o EventList.o Event.o NameList.o Name.o -o p1 ls -w 60
DataManager.cpp EventList.cpp main.o NameList.h
DataManager.h EventList.h Makefile NameList.o
DataManager.o EventList.o Name.cpp Name.o
Event.cpp Event.o Name.h p1
Event.h main.cpp NameList.cpp
It seems to work just fine for me.
Did you notice that you misspelled strict_ansi
in every target after the first?
E. Robert Tisdale wrote: It seems to work just fine for me.
Did you notice that you misspelled strict_ansi in every target after the first?
Yea, those I fixed. See my reply to the original post. It was all
because I didn't have any spaces at the end of each line, and also
because I didn't have an extra line at the end of the file.
Max wrote: Still no luck :(
% ls
^
You need to configure your shell - probably by setting PS1 - to reflect your
current folder. That makes BASHing (or using whatever SHell you use) a
little easier.
(BTW you have probably been warned this question is off topic. Hence we can
answer any part of it we feel like ;-)
--
Phlip http://industrialxp.org/community/bi...UserInterfaces This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Janne Naukkarinen |
last post by:
Have someone commercial Digital
Mars (DMC) IDDE?
I need help making makefiles, it is
easier with IDDE.
However, IDDE is not freely distributed on net.
There is current WinVN WIP:
|
by: djake |
last post by:
Someone can explain me what are makefiles useful for? Couldn't i write
shell script instead of makefiles? (*.sh in unix; *.cmd in win32)
Moreover i really doesn't understand what dependencies are...
|
by: A. Gupta |
last post by:
I'm compiling a project that I want to have multiple targets
(basically debug and optimized). I would like to just be able to type
'make debug' or 'make optimized' and have the makefile compile...
|
by: JS |
last post by:
I have two Makefiles in two different directories. How do I know which of
these Makefiles make will use and is there some way to specify which
Makefile that should be run.
|
by: mmashaie |
last post by:
Hi,
I'm trying to compile a makefile. On my command line, I type make and I
get the below message; I don't understand why I get that. I am using
Borland C++ version 2:
C:\Maryam\clarke> make...
|
by: milkyway |
last post by:
Hello,
I am running under Suse Linux and am putting together some code written
in C. I am not clear on how to create makefiles and was wondering if
there were any "makefile tools" out there. If...
|
by: Jess |
last post by:
Hello,
I am now trying to use makefile to compile C++ programs. My makefile
looks like:
f1.o : f1.cpp h1.h h2.h
g++ -c f1.cpp
f2.o : f2.cpp h2.h h3.h
g++ -c f2.cpp
|
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= |
last post by:
I already understand how program compilation works (i.e. the
preprocessor produces individual translation units which get compiled
separately, and then the linker links the object files together),...
|
by: tvnaidu |
last post by:
porting windows static libs and dll into linux static lib abd shared lib, any tool to convert vcproj files to Linux makefiles?
porting windows static libs and dll into linux static lib abd shared...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |