3 Replies - 62371 Views - Last Post: 04 October 2006 - 06:38 PM Rate Topic: -----

#1 ProgrammersHell  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 1
  • Joined: 03-October 06

error LNK2019: unresolved external symbol

Posted 03 October 2006 - 04:26 PM

I am working on this problem for C++ class, and have hit a brick wall. Here is my code:

// Chpt5Lab1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	void intmoney(float, float&, float&);
		float dollars, intcoin, fracoin;
	do
	{
		cout << "Enter an amount in dollars and cents: (i.e. 91.25)" << endl;
		cin >> dollars;
		intmoney(dollars, intcoin, fracoin);
		cout << "You have " << dollars << " dollars and " << fracoin << " cents." << endl;
	}
	while(dollars != 0.0);
	return 0;
}


////////////////////////////////////////////////////////////////////////////////////////////

void intmoney(int d, float& intc, float& frac)
{
	long temp = static_cast<long>(d);
	intc = static_cast<float>(temp);
		frac = d - intc;
}



and here are the errors I am getting:

Quote

------ Build started: Project: Chpt5Lab1, Configuration: Debug Win32 ------
Compiling...
Chpt5Lab1.cpp
Linking...
Chpt5Lab1.obj : error LNK2019: unresolved external symbol "void __cdecl intmoney(float,float &,float &)" (?intmoney@@YAXMAAM0@Z) referenced in function _wmain
C:\Documents and Settings\Michael\My Documents\Visual Studio 2005\Projects\Chpt5Lab1\Debug\Chpt5Lab1.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Michael\My Documents\Visual Studio 2005\Projects\Chpt5Lab1\Chpt5Lab1\Debug\BuildLog.htm"
Chpt5Lab1 - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I have looked and looked, googled the hell out of the error, and keep coming up blank. This is my first post here. My professor actually pointed us to this site. I don't expect anyone to do my work for me, just maybe point me in the right direction. Thanks in advance for any help given!!

Sincerely,
ProgrammersHell

edit: fixed [code] tags ~ jayman9

This post has been edited by Dark_Nexus: 03 October 2006 - 06:16 PM


Is This A Good Question/Topic? 2

Replies To: error LNK2019: unresolved external symbol

#2 dorknexus  Icon User is offline

  • or something bad...real bad.
  • member icon

Reputation: 1256
  • View blog
  • Posts: 4,618
  • Joined: 02-May 04

Re: error LNK2019: unresolved external symbol

Posted 03 October 2006 - 06:19 PM

first problem i see is here

int _tmain(int argc, _TCHAR* argv[])
{
	void intmoney(float, float&, float&);
		float dollars, intcoin, fracoin;
 //continued...



you are declaring a function from within a function void intmoney(float, float&, float&);

if your intent was to invoke that function, then you don't need to include the void keyword, and can simply use the name of the function, and then pass correspondng variables.
Was This Post Helpful? 0
  • +
  • -

#3 shec0002  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-October 06

Re: error LNK2019: unresolved external symbol

Posted 04 October 2006 - 10:56 AM

You can always start by looking at what your warning means.
http://msdn2.microso...y/799kze2z.aspx
Was This Post Helpful? 0
  • +
  • -

#4 Xing  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 19
  • View blog
  • Posts: 725
  • Joined: 22-July 06

Re: error LNK2019: unresolved external symbol

Posted 04 October 2006 - 06:38 PM

View Postshec0002, on 4 Oct, 2006 - 11:26 PM, said:

You can always start by looking at what your warning means.
http://msdn2.microso...y/799kze2z.aspx

Yup, that's a very good suggestion. Try not to ignore warnings.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1