473,387 Members | 1,844 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.

need help on this program linker error !!

15
hi guys,

i have this program but it wont compile on DEV C++, it compiles on Borland actually, my compiler say:

[linker error] undefine reference hms (long, long*,long*,long)
ld return 1 exit status

can someone tell me what is this all about?

heres my code:

#include <stdio.h>
#include<math.h>

void hms(long int, long int*, long int*, long int*);


int main()

{
long int time;
long int hr, mn, sc;
time = hr = mn = sc = 0;
printf("Enter the total number of seconds: ");
scanf("%ld", &time);
hms(time, &hr, &mn, &sc);
printf("\n%ld seconds are %ld hours, %d minutes and %ld seconds",time, hr, mn, sc);
return 0;
}

void hms(long int time, int *hr, long int *mn, long int *sc)

{
*hr = time / 3600;
*mn = (time - (*hr * 3600)) / 60;
*sc = (time - (*hr * 3600) - (*mn * 60));
}
Jan 9 '07 #1
1 1221
horace1
1,510 Expert 1GB
your hms() function prototype is
Expand|Select|Wrap|Line Numbers
  1. void hms(long int, long int*, long int*, long int*);
  2.  
second parameter is long int*

but in the function definition the function header is
Expand|Select|Wrap|Line Numbers
  1. void hms(long int time, int *hr, long int *mn, long int *sc)
second parameter is int*

change the definition to match the prototype
Expand|Select|Wrap|Line Numbers
  1. void hms(long int time, long int *hr, long int *mn, long int *sc)
  2.  
Jan 9 '07 #2

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

Similar topics

1
by: endo55 | last post by:
Hi I've got the following errors when trying to compile a program cvision error LNK2001: unresolved external symbol _IID_IGraphBuilde cvision error LNK2001: unresolved external symbo...
9
by: Peter Oliphant | last post by:
For some reson my code is generating a LNK1215 error, which 'suggests' I re-install VS C++. So I did. which did NOT solve the problem. The weid part is it seems to be caused by my one CPP file, but...
4
by: yogesh | last post by:
mysql in c++ initialize error occurs a simple program is executed in redhat9.0 , using gcc 3.2.2 compiler version ... #include <stdio.h> #include <mysql.h> #include <string.h> int main() {
12
by: Marko.Cain.23 | last post by:
Hi, i have a c++ program and I want to call a c function (some legacy code). So I have this in my Producer.c int initproducer() { printf (" init producer \n"); } And I want to call...
1
by: Herman.Schultz | last post by:
I am getting the following undefined reference linker error when I compile my program: FileModule.o: In function `DoFile': /home/herman/src/FileModule.cpp:665: undefined reference to `VLC_Init'...
39
by: Ravi | last post by:
Can you all please suggest a program which tell us the range of memry addresses occupied by the given c program?
1
by: Deepath G | last post by:
This is deepath.. I am getting some linker error when i am trying to connect Websphere MQ using Borland C++ Builder 2006 using imqi.hpp on windows. Error Message ----------------------- ...
18
by: Angus | last post by:
Hello We have a lot of C++ code. And we need to now create a library which can be used from C and C++. Given that we have a lot of C++ code using classes how can we 'hide' the fact that it is...
24
by: kevin | last post by:
write a program in c.
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: 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: 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
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...
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.