<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'linker error and combine functions?' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'linker error and combine functions?' posted on the 'C and C++' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 18 May 2013 14:47:14 -0700</pubDate>
    <lastBuildDate>Sat, 18 May 2013 14:47:14 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>linker error and combine functions?</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/375694/375694/linker-error-and-combine-functions/</link>
      <description>I started a program that calculates an employee's weekly gross pay when the user inputs hours worked and hourly pay rate.  With what I have so far, it compiles fine, but gives these errors:&lt;br /&gt;
&lt;br /&gt;
on Dev-C++:&lt;br /&gt;
message: [Linker error] undefined reference to 'get_pay(float, float)'&lt;br /&gt;
         Id returned 1 exit status&lt;br /&gt;
file: C:\Dev-Cpp\Programs\Makefile.win  message: [Build Error][grossPay.exe] Error 1&lt;br /&gt;
&lt;br /&gt;
on Visual Studio 2005:&lt;br /&gt;
1&amp;gt;------ Build started: Project: grossPay, Configuration: Debug Win32 ------&lt;br /&gt;
1&amp;gt;Linking...&lt;br /&gt;
1&amp;gt;grossPay.obj : error LNK2019: unresolved external symbol "void __cdecl get_pay(float,float)" &lt;br /&gt;
&lt;br /&gt;
How do I resolve this linker error?  And also, how would I add if/else statements for the following condition?  If the employee's weekly gross pay is more than $200 (personal exemption), then the employee pays 12% federal tax and 5% state tax from his taxable income (gross pay - exemption).  I'd also like to combine the functions I have so that taxable income, fed tax, and state tax are all calculated in the same function.&lt;br /&gt;
&lt;br /&gt;
Here's what I have:&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
void get_pay(float wage, float hours);&lt;br /&gt;
float calc_gross_pay(float wage, float hours);&lt;br /&gt;
float calc_net(float gross, float deduct);&lt;br /&gt;
void print_gross_pay(float);&lt;br /&gt;
void print_net(float);&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    float wage,hours,gross,deduct,sum;&lt;br /&gt;
    &lt;br /&gt;
    get_pay(wage, hours);&lt;br /&gt;
    gross = calc_gross_pay(wage, hours);&lt;br /&gt;
    sum = calc_net(gross, deduct);&lt;br /&gt;
    print_gross_pay(gross);&lt;br /&gt;
    print_net(sum);&lt;br /&gt;
&lt;br /&gt;
    system("PAUSE");&lt;br /&gt;
    return EXIT_SUCCESS;&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void get_pay(float&amp;amp; wage, float&amp;amp; hours)&lt;br /&gt;
{&lt;br /&gt;
    cout &amp;lt;&amp;lt; "Enter your hourly wage: ";&lt;br /&gt;
    cin &amp;gt;&amp;gt; wage;&lt;br /&gt;
    cout &amp;lt;&amp;lt; "Enter your hours worked: ";&lt;br /&gt;
    cin &amp;gt;&amp;gt; hours;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
float calc_gross_pay(float wage, float hours)&lt;br /&gt;
{&lt;br /&gt;
    return wage * hours;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
float calc_net(float gross, float deduct)&lt;br /&gt;
{&lt;br /&gt;
   return gross - deduct;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void print_gross_pay(float gross)&lt;br /&gt;
{&lt;br /&gt;
    cout &amp;lt;&amp;lt; "Your gross pay is:  " &amp;lt;&amp;lt; gross;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void print_net(float sum)&lt;br /&gt;
{&lt;br /&gt;
    cout &amp;lt;&amp;lt; "Your net pay is: " &amp;lt;&amp;lt; sum;&lt;br /&gt;
}&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/375694/375694/linker-error-and-combine-functions/</guid>
      <pubDate>Sat, 20 Sep 2008 16:47:54 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: linker error and combine functions?</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/375694/375708/re-linker-error-and-combine-functions/#375708</link>
      <description>There's nothing wrong I can see with your program. get_pay is prototyped and the body is provided. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/375694/375708/re-linker-error-and-combine-functions/#375708</guid>
      <pubDate>Sun, 21 Sep 2008 02:19:05 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: linker error and combine functions?</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/375694/375709/re-linker-error-and-combine-functions/#375709</link>
      <description>the prototype provided was for&lt;br /&gt;
void get_pay(float wage, float hours);&lt;br /&gt;
but the definition provided was for&lt;br /&gt;
void get_pay(float &amp;amp; wage, float &amp;amp; hours)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
try to add such operator '&amp;amp;' in the prototype&lt;br /&gt;
&lt;br /&gt;
for your if-statement question&lt;br /&gt;
my advice is to read any book in C, C++, or even JAVA&lt;br /&gt;
if-statements are very similar in these languages&lt;br /&gt;
&lt;br /&gt;
see ya&lt;br /&gt;
Mohammad Nasim</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/375694/375709/re-linker-error-and-combine-functions/#375709</guid>
      <pubDate>Sun, 21 Sep 2008 03:55:39 -0700</pubDate>
      <category>C and C++</category>
    </item>
    <item>
      <title>Re: linker error and combine functions?</title>
      <link>http://www.programmersheaven.com/mb/CandCPP/375694/375721/re-linker-error-and-combine-functions/#375721</link>
      <description>Thank you for the prototype advice!  It worked and I'm making some progress on the if else statements.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/CandCPP/375694/375721/re-linker-error-and-combine-functions/#375721</guid>
      <pubDate>Sun, 21 Sep 2008 07:53:07 -0700</pubDate>
      <category>C and C++</category>
    </item>
  </channel>
</rss>