Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / August 2007

Tip: Looking for answers? Try searching our database.

Unresolved token ERROR

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jazihak@gmail.com - 10 Aug 2007 22:38 GMT
Can any one tell me how to resolve this issue;

I have the following function

//hello.cpp
#include "stdafx.h"
#include <stdlib.h>
#include <vcclr.h>
#include <string>
namespace Wrapper
{

String^ Wrapper_Class::sayHello(void){
String^ str="Hello";
return str;
}
}

//hello.h
#pragma once

#include "string"
#include <stdio.h>
#include <stdlib.h>
#include "stdafx.h"

using namespace System::Runtime::InteropServices;
using namespace System;
using namespace std;

String^ Wrapper_Class::sayHello(void)

Here is the ERROR message I keep getting
error LNK2020: unresolved token (06000012)
Wrapper.Wrapper_Class::sayHello
fatal error LNK1120: 1 unresolved externals

Can any one tell me what am I doing wrong? or how to resolve it?  Is
there any headers that I need to include?

Thank you...
JZ
Dave Heinemann - 17 Aug 2007 02:22 GMT
hello.cpp needs to include hello.h

Of course C++ error messages make it sound complex.  The language has dozens
of keywords, thousands of error messages.
Ben Voigt [C++ MVP] - 17 Aug 2007 21:02 GMT
> Can any one tell me how to resolve this issue;
>
[quoted text clipped - 13 lines]
> }
> }

This definition is inside namespace Wrapper.

> //hello.h
> #pragma once
[quoted text clipped - 9 lines]
>
> String^ Wrapper_Class::sayHello(void)

This prototype is in the global namespace.  Additionally, it forward
declares that a namespace (you can't prototype class members outside the
class definition) Wrapper_Class exists containing a global function
sayHello.  When the linker doesn't find it, it gives the unresolved token
error.

> Here is the ERROR message I keep getting
> error LNK2020: unresolved token (06000012)
[quoted text clipped - 6 lines]
> Thank you...
> JZ

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.