error linking

Thread Solved

Join Date: Oct 2007
Posts: 280
Reputation: joshmo is an unknown quantity at this point 
Solved Threads: 19
joshmo joshmo is offline Offline
Posting Whiz in Training

error linking

 
0
  #1
Nov 9th, 2007
I have gotten a problem compiling. the program gives me an LNK2001 error so there seems to be a problem with my function but i cant seem to find it..i am posting part of the function that calls and the original function being called

void disp()
time_info start, end;
time_increment(hours_count,minute_count,day_count,month_count,year_count,start,end); for (i=0;i<S;i++)
{
n++;
cout<< "Your call " <<n<<" started at " <<time_and_date[i].start.hours<<":"
<<time_and_date[i].start.minutes<<"/"

<<time_and_date[i].start.day<<"/"<<time_and_date[i].start.month
<<"/" << time_and_date[i].start.year;
cout<< " and ended at "<<time_and_date[i].end.hours<<":"<<time_and_date[i].end.minutes<<"/"
<<time_and_date[i].end.day<<"/"<<time_and_date[i].end.month<<"/"
<< time_and_date[i].end.year<<endl<<endl;

cout<< "The duration is " << hours[i] << " Hour(s) and " <<minutes[i] <<" Minutes"<<endl<<endl;

hours_count=hours[i]+hours_count;
minute_count=minutes[i]+minute_count;

rate=call_cost();

}

here is part of the function being called...the code is half because the procedure in the for loop is repeated for hours, days e.t.c

void time_increment(int& hours_count,int&minute_count, double& day_count,double& month_count,double& year_count,time_info& start, time_info& end)

if (!equality())
if (sec_count = 60)
for(i=0;i<S;i++)
{
temp_start=time_and_date[i].start.minutes;
temp_end=time_and_date[i].end.minutes;
for(a=temp_start;a<temp_end;a++)
{
minute_count++;
minutes[i]=minute_count;
}
}
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 8,311
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 824
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: error linking

 
0
  #2
Nov 9th, 2007
Check your spelling, check the number of arguments, check the type of arguments, and if none of that works, make a tiny program that exhibits the problem so that we can actually compile and link it ourselves instead of trying to decipher the snippets that you think are relevant.
In case you were wondering, yes, I do hate you.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,820
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 213
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso

Re: error linking

 
0
  #3
Nov 9th, 2007
Are your variables:
day_count,month_count,year_count
doubles or ints? The function is expecting references to doubles, but by their names I'd expect the actual arguments to be declared as integers.

As Narue said, a full example of the problem would be helpful.

Val
Don't own a gun but I'm going to join the NRA.
I figure anything that irritates liberals is worth my support.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 280
Reputation: joshmo is an unknown quantity at this point 
Solved Threads: 19
joshmo joshmo is offline Offline
Posting Whiz in Training

Re: error linking

 
0
  #4
Nov 10th, 2007
The whole code works well but when it is modularized that is when i get this error..
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 6,584
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 848
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: error linking

 
0
  #5
Nov 10th, 2007
Well if you posted the actual error message, we can tell you what is missing, and where to start looking.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
--
If your code lacks code tags, you will be IGNORED
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 280
Reputation: joshmo is an unknown quantity at this point 
Solved Threads: 19
joshmo joshmo is offline Offline
Posting Whiz in Training

Re: error linking

 
0
  #6
Nov 11th, 2007
this is the error message i get
main.obj : error LNK2001: unresolved external symbol "void __cdecl time_increment(int &,int &,double &,double &,double &,struct time_info &,struct time_info &)" (?time_increment@@YAXAAH0AAN11AAUtime_info@@2@Z)
Debug/main.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 6,584
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 848
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: error linking

 
0
  #7
Nov 11th, 2007
So is time_increment() in another source file, other than main.cpp ?
You need to make sure ALL the source files are listed in the project, otherwise they don't get compiled and linked together.

If it is in the project, then make sure it compiles without errors.
Perhaps even check that you haven't accidentally commented out the entire function.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
--
If your code lacks code tags, you will be IGNORED
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,820
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 213
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso

Re: error linking

 
0
  #8
Nov 11th, 2007
For the third time, please post the code that shows all references to the function. Its prototype, its implementation, and where you call it, the declaration of the variables you pass as arguments. Without that information, we cannot help you. Other than to take pot shots in the dark, such as:

Check that the prototype and the implementation agree in the parameter list.
Check that you are sending variables of the correct types to the reference parameters.
Check that the phase of moon is correct for your compiler version.
Don't own a gun but I'm going to join the NRA.
I figure anything that irritates liberals is worth my support.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 280
Reputation: joshmo is an unknown quantity at this point 
Solved Threads: 19
joshmo joshmo is offline Offline
Posting Whiz in Training

Re: error linking

 
0
  #9
Nov 15th, 2007
apparently the problem was with the visual studio settings so it couldnt link
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 856 | Replies: 8
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC