unresolved external symbol

build error unresolved external symbol

Page 1 of 1

5 Replies - 1788 Views - Last Post: 01 May 2009 - 12:49 PM Rate Topic: -----

#1 jsaurer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 30-April 09

unresolved external symbol

Post icon  Posted 30 April 2009 - 03:54 PM

I have a code to reverse a sentence. It compiles fine but I get an error when I build. This is the code
#include <string>
#include <iostream>

using namespace std;


/**
   Reverse a sentence.
*/
class Sentence
{
public:
   /**
	  Creates a Sentence object.
	  @param aPhrase a sentence to reverse.
   */
   Sentence(string aPhrase);
   
   /**
	  Reverses this sentence.
	  @return the reversed sentence
   */
   string reverse();
	 
private:
   string phrase;
};

Sentence::Sentence(string aPhrase)   
{
   phrase = aPhrase;
}

  
string Sentence::reverse()
{
   if (phrase != "")
   {
	  string c = phrase.substr(0, 1);
	  string rest = phrase.substr(1, phrase.length() - 1);
	  Sentence tailSentence(rest);
	  phrase = tailSentence.reverse() + c;
   }
   return phrase;
}

int main()
{
   Sentence greeting("Hello!");
   cout << greeting.reverse() << "\n";
   return 0;
}




This is the error
------ Build started: Project: HorstmannGraphics, Configuration: Debug Win32 ------
Linking...
ccc_msw.obj : error LNK2019: unresolved external symbol "int __cdecl ccc_win_main(void)" (?ccc_win_main@@YAHXZ) referenced in function "long __stdcall ccc_win_proc(struct HWND__ *,unsigned int,unsigned int,long)" (?ccc_win_proc@@YGJPAUHWND__@@IIJ@Z)
C:\Users\Jessica\Documents\Visual Studio 2008\Projects\HorstmannGraphics\Debug\HorstmannGraphics.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Users\Jessica\Documents\Visual Studio 2008\Projects\HorstmannGraphics\HorstmannGraphics\Debug\BuildLog.htm"
HorstmannGraphics - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm not sure what this means.

Is This A Good Question/Topic? 0
  • +

Replies To: unresolved external symbol

#2 nirvanarupali  Icon User is offline

  • D.I.C Stomach
  • member icon

Reputation: 13
  • View blog
  • Posts: 1,119
  • Joined: 01-August 07

Re: unresolved external symbol

Posted 30 April 2009 - 05:43 PM

Check out your compiler.

Your codes is working just fine to me. I am using C++ Borland 5.5
Was This Post Helpful? 0
  • +
  • -

#3 apw5020  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 666
  • Joined: 26-March 09

Re: unresolved external symbol

Posted 30 April 2009 - 07:08 PM

Under the build tab, try cleaning and/or rebuilding your project.
Was This Post Helpful? 0
  • +
  • -

#4 jsaurer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 30-April 09

Re: unresolved external symbol

Posted 01 May 2009 - 12:34 PM

I tryed the clean and it didn't work. I can't change the compiler because the one I am using was specified by my instructor. Is there some sort of add on I need to add. We had to add a graphics feature but I didn't see the ccc_win_proc, ccc_win_main in the list for the Horstmann graphics.
Was This Post Helpful? 0
  • +
  • -

#5 eker676  Icon User is offline

  • Software Engineer
  • member icon

Reputation: 378
  • View blog
  • Posts: 1,833
  • Joined: 18-April 09

Re: unresolved external symbol

Posted 01 May 2009 - 12:43 PM

I just compiled and ran that code with Visual Studio 2008. Try making a new project and copying the code into it.
Was This Post Helpful? 0
  • +
  • -

#6 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,141
  • Joined: 14-September 07

Re: unresolved external symbol

Posted 01 May 2009 - 12:49 PM

Based on the error message you made a Win32 project, but then wrote a console program. i.e. you're missing WinProc()
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1