473,383 Members | 1,880 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,383 software developers and data experts.

Compiling simple program with several files, UNIX

62
Hi everyone!
I am trying to compile a very simple program on UNIX, which consists of several files, each of them has a function that prints out a string of text.
Then the file with the main function call each of these functions.
Here are the codes in the files:

Expand|Select|Wrap|Line Numbers
  1. //****** hello.h
  2. void func_hello();
  3.  
  4.  
  5. //******hello.c
  6. #include <stdio.h>
  7. #include "hello.h"
  8. void func_hello()
  9. {
  10. printf("Hello, how are you?\n");
  11. }
  12.  
  13.  
  14. //****** myApp.c
  15. #include <stdio.h>
  16. #include "hello.h"
  17. void main()
  18. {
  19. func_hello();
  20. func_here();
  21. func_bye();
  22. }
  23.  
  24.  
And this is the output I get after trying to compile it using a makefile:

Expand|Select|Wrap|Line Numbers
  1. % make -f myMakefile
  2.  
  3. cc -o myApp hello.o here.o bye.o
  4. Undefined                       first referenced
  5.  symbol                             in file
  6. main                                /vol/PACK/SunWorkshop/SUNWspro/SC4.2/lib   /crt1.o
  7. ld: fatal: Symbol referencing errors. No output written to myApp
  8. *** Error code 1
  9. make: Fatal error: Command failed for target `myApp'
  10.  

Can anyone please tell me what's wrong here??? Please!
Feb 5 '08 #1
4 1594
where is the makefile?
Feb 5 '08 #2
jewel87
62
here is my makefile:
Expand|Select|Wrap|Line Numbers
  1.  
  2. myApp : hello.o here.o bye.o
  3.         cc -o myApp hello.o here.o bye.o
  4.  
  5. hello.o : hello.c
  6.         cc -c hello.c
  7. here.o : here.c
  8.         cc -c here.c
  9. bye.o : bye.c
  10.         cc -c bye.c
  11.  
  12. clean :
  13.         rm -f hello.o here.o bye.o
  14.  
  15.  
  16.  
Feb 5 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
So where is myApp.c compiled ??
Feb 5 '08 #4
jewel87
62
So where is myApp.c compiled ??
Actually, I was confused by your question at first, but then suddenly i got what you mean! Thank you a lot!!! It's now alright!
Feb 5 '08 #5

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

Similar topics

6
by: Martin Bless | last post by:
The good news: Along with Python-2.4 comes really good news to Windows users. Yes, you now CAN build extension modules yourself using the SAME C++ compiler and linker Python is built with...
4
by: Jimmie | last post by:
Sorry to bother you guys but I am kind of new to compiling c++ source code on unix systems. My problem is, I have a basic class program that calculates the stattistical values of 30 integers, I...
6
by: johnnieboy | last post by:
I am trying to compile the program hull http://cm.bell-labs.com/netlib/voronoi/hull.html This is quite a complicated program that involves several .c files I get several warnings during...
6
by: wooks | last post by:
Sorry if this is very basic. I have bought a Functional Programming book that uses the language Hope. I have managed to locate and extract Ross Pattersons hope interpreter from...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
9
by: Sheldon | last post by:
Good day Everyone, I am a still very new at learning C and I have thrown myself in the deep end. I started with a simple program and kept widening the scope. This has taught me many things about...
10
by: Tomás Ó hÉilidhe | last post by:
I'd post this on a gcc newsgroup but I'd be more productive talking to the wall. Anyway, let's say someone throws some source code at you for a particular program and says, "Just compile it, it...
60
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
On May 3, 8:09 am, apati...@gmail.com wrote: A programmer that uses Vista? :O Vista is a hog of an operating system. Downgrade to Windows XP or get yourself a Linux distro.
6
by: Oliver Graeser | last post by:
Ok, stupid question.... I used to write programs all into one text files and compile them. Works, fine. Then I discovered XCode (or IDEs in general) which appear to be really increasing my...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.