473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to create makefiles in cpp

we have been working with a project and we need to create the executables
could u please help us in this aspect

we tried make files this way

vi lab.make

lab.out:prog1.o
g++ -o lab.out prog1.o
prog1.o:prog1.cpp stdio.h
g++ -c prog1.cpp

we executed with
make -f lab.make

its displaying error as fatal error at end of line
thanks in advance
Aug 10 '07 #1
4 1367
JosAH
11,448 Expert 8TB
we have been working with a project and we need to create the executables
could u please help us in this aspect

we tried make files this way

vi lab.make

lab.out:prog1.o
g++ -o lab.out prog1.o
prog1.o:prog1.cpp stdio.h
g++ -c prog1.cpp

we executed with
make -f lab.make

its displaying error as fatal error at end of line
thanks in advance
There should be a tab (or at least a space) as the leading character of the
command execution line; like this:

Expand|Select|Wrap|Line Numbers
  1. lab.out:prog1.o
  2.         g++ -o lab.out prog1.o
  3. prog1.o:prog1.cpp stdio.h
  4.         g++ -c prog1.cpp
  5.  
kind regards,

Jos
Aug 10 '07 #2
we have been working with a project and we need to create the executables
could u please help us in this aspect

we tried make files this way

vi lab.make

lab.out:prog1.o
g++ -o lab.out prog1.o
prog1.o:prog1.cpp stdio.h
g++ -c prog1.cpp

we executed with
make -f lab.make

its displaying error as fatal error at end of line
thanks in advance
Did you get error free execution ?

Regards,
Girish.
Aug 10 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
(or at least a space)
Check the O'Reilly book on make. I think this needs to be a tab.
Aug 10 '07 #4
JosAH
11,448 Expert 8TB
Check the O'Reilly book on make. I think this needs to be a tab.
Yes, old makes need a tab; GNU make for example is happy with one or more
spaces too (hurray for user friendliness! ;-)

kind regards,

Jos
Aug 10 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: dharmesh Gupta | last post by:
Dear All, can anyone pls tell me how to make a makefile with a small example. i am very confused. Thanks to all
1
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:
12
by: Max | last post by:
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...
5
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...
2
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...
10
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.
3
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...
19
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...
22
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),...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.