4 Replies - 274 Views - Last Post: 01 April 2013 - 08:34 PM Rate Topic: -----

#1 mindsaber  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 28-November 12

Error LNK 2019 cant resolve

Posted 01 April 2013 - 08:03 PM

#include<iostream>
#include<cctype>
#include<cstring>
using namespace std;

int wordCount (char*);

void main()
{
	const int size= 50;
	char string1[size];
	int words;

	cout<<"Enter String: ";
	cin.getline(string1,size);
	words=wordCount(string1);

	cout<<"Number of Words: "<<words<<endl;

	system("pause");
}

int wordcount (char *str)
{
	int count = 1;
	while(*str!='\0')
	{
		if(*str==' ')
			count++;
			str++;
	}

	return count;
}




Im getting a LNK2019 error for my function prototype... it stats
"1>WordCount.obj : error LNK2019: unresolved external symbol "int __cdecl wordCount(char *)" (?wordCount@@YAHPAD@Z) referenced in function _main"

I have no idea how to fix this any ideas???

Is This A Good Question/Topic? 0
  • +

Replies To: Error LNK 2019 cant resolve

#2 jimblumberg  Icon User is offline

  • member icon


Reputation: 4025
  • View blog
  • Posts: 12,420
  • Joined: 25-December 09

Re: Error LNK 2019 cant resolve

Posted 01 April 2013 - 08:09 PM

Check the spelling of your function, remember C++ is case sensitive.


Also main should be defined as int main(), not void main().


Jim
Was This Post Helpful? 0
  • +
  • -

#3 mindsaber  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 28-November 12

Re: Error LNK 2019 cant resolve

Posted 01 April 2013 - 08:21 PM

I checked the spelling and everything is fine. I don't understand why it would be giving me an error. The only thing I can think of is that the pointer that I am using.
Was This Post Helpful? 0
  • +
  • -

#4 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,279
  • Joined: 28-March 11

Re: Error LNK 2019 cant resolve

Posted 01 April 2013 - 08:28 PM

Look again. Look at line 6, 16, and then the function on line 23.
Was This Post Helpful? 0
  • +
  • -

#5 mindsaber  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 28-November 12

Re: Error LNK 2019 cant resolve

Posted 01 April 2013 - 08:34 PM

hahaha wow thank you guys such a small mistake that I would have probably not have caught.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1