Sponsored Content
Homework and Emergencies Homework & Coursework Questions Create Makefile from source files Post 302954216 by Don Cragun on Saturday 5th of September 2015 04:19:29 PM
Old 09-05-2015
Look... We aren't going to do your homework for you. And make and gcc pretty much tell you exactly what is wrong. So tackle each reported error until you have fixed your makefile to correctly build frprog, gqprog, and vwprog.

So, let's start with your first problem:
Quote:
Code:
g++ -o frprog fr.o
fr.o: In function `main':
fr.cc:(.text+0x21): undefined reference to `f1()'
collect2: error: ld returned 1 exit status
Makefile:4: recipe for target 'frprog' failed
make: *** [frprog] Error 1

Just looking at the above output and your makefile (without even looking at your source files), tells us that fr.cc includes a function called main() and main() calls a function called f1(). And, f1() is not defined in fr.cc.

Do you have another source file that defines f1()? If so, you need to add the object file produced from that source as a dependency for frprog. If not, you need to write some code that does define it in fr.cc or add it to another file and update the dependencies in your makefile.

Moving on to your second problem... Do you have a header that isn't in the same directory as your source files (and isn't a standard header found in /usr/include), is there an option you can give to gcc to tell it to look for headers in another directory? If so, update the rules for making the object(s) that depends on that missing header to tell gcc where to find that header when building that(those) object file(s).

And, your third problem looks very similar to your first problem.

Note also that make is very picky about <tab> and <space> characters in rules in makefiles. You have shown us sequences of spaces in your sample makefile that are required to be tab characters. (We can assume that you copied the makefile out of a vi editing window instead of actually copying and pasting your makefile, but be aware that they are not interchangeable. (And, when you don't use CODE tags to show us your makefile, sequences of spaces and tabs are converted to a single space and leading spaces are discarded completely when we try to read your code. So, PLEASE use CODE tags when showing us sample input, sample output, and sample code segments. ICODE tags are fine for partial line snippets of sample code, but multi-line code segments need CODE tags; not ICODE tags.)
 

10 More Discussions You Might Find Interesting

1. Programming

about create Makefile

hello! i want to create a Makefile on the freebsd 4.5,so i vi the hello.c #include int main(int argc, char** argv) { printf(''Hello, GNU!\n''); return 0; } #autoscan #cp configure.scan configure.in #vi configure.in modify:AC_OUTPUT AC_OUTPUT(Makefile) #aclocal #autoconf... (0 Replies)
Discussion started by: mzp
0 Replies

2. Programming

Makefile compilation Error -Unable to create executable

Hi , While trying to compile a PRO*C code on unix using makefile i get the following errors. i am now working on a 10g migration (from 8i) ... these makefile perfectly work in previous version. ld: fatal: file... (7 Replies)
Discussion started by: sivalives
7 Replies

3. UNIX for Dummies Questions & Answers

create raidctl mirror with mounted source parition

I am mirroring a single partition drive with raidctl. The source partition was mounted when I created the mirror with raidctl -c c1t1d0 c1t3d0. The source disk was defined with s2 and s6 only. I didn't think to umount it first. Is there a problem with that? (2 Replies)
Discussion started by: csgonan
2 Replies

4. Shell Programming and Scripting

Makefile cant create new install path

..... (2 Replies)
Discussion started by: mercury
2 Replies

5. Shell Programming and Scripting

ksh script to create a generic csv file from different source formats

Hi all, I have a requirement to create a "superset" file out of a number of different sources with some different and some same columns. We intend to have a manually updateable SuperSetCols.csv which would look like "ColA","ColB","ColC","ColD","ColE","ColF","ColG" so someday we may add... (3 Replies)
Discussion started by: Leedor
3 Replies

6. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

7. Shell Programming and Scripting

automake does not create Makefile.in

hi all, I have written a simple C program hello.c and a Makefile.ac but when i try to run automake it does not create Makefile.in hence I am not able to run ./configure command in my directory. Following are the containts of my prog. hello.c -------- Code: #include<stdio.h> main() {... (0 Replies)
Discussion started by: useless79
0 Replies

8. Linux

Create a bootable PXE image from build kernel source code

Hi, Can i just ask how I can create a bootable PXE image from the built kernel source. What files do I need to get? Thanks! (1 Reply)
Discussion started by: h0ujun
1 Replies

9. UNIX for Dummies Questions & Answers

Create a tgz from source FreeBSD

Hello, i'm having a problem here with FreeBSD 9.2 . I've created a directory and downloaded the latest ntp-4.2.8p1-beta2 from ntp.org. Untar then into the directory and then ./configure all went OK. Then i had to modify some parameters in the config.h created with ./configure . Then make... (2 Replies)
Discussion started by: Board27
2 Replies

10. Programming

Makefile instructions to create directories (CentOS7 , GNU Make 3.82)

Hello, My makefiles are set up to generate an environment specific build directory based on the local configuration and some values passed to make. It generally looks like, # compilers, may be passed to make CC++ = g++ FCOMP = gfortran # version of program, may be passed to make ver =... (4 Replies)
Discussion started by: LMHmedchem
4 Replies
All times are GMT -4. The time now is 02:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy