473,396 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Unresolved token ERROR

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

Aug 10 '07 #1
2 1444
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.
Aug 17 '07 #2

<ja*****@gmail.comwrote in message
news:11**********************@j4g2000prf.googlegro ups.com...
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;
}
}
This definition is inside namespace Wrapper.
>
//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)
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)
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

Aug 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Kantowitz | last post by:
I am trying to wrap a native-C++ DLL in managed C++, to use in a .NET project. The native code is compiled into a DLL, and I have created a .def file that exports the mangled names of the...
0
by: Raja | last post by:
Hi, I use windows 2000 professional and have a code written in Microsoft Visual C++ .Net. Everytime i build the program I get an unresolved token error, something like LINK : error LNK2020:...
0
by: Stephen Ahn | last post by:
Using : VS.NET 2003, I'm attempting to create a mixed-mode C++ DLL (i.e. has both managed and unmanaged code). When attempting to reference globals _timezone and _daylight, I get the following...
1
by: Tony Baker | last post by:
Hi, If I 1) create a brand new Visual C++ Project -> Class Library (.Net) 2) in the stdafx.h file add #include <atlbase.h> I get the following errors: ------ Build started: Project: testATL,...
1
by: Joel Rondeau | last post by:
I am building a mixed-mode DLL with VS.NET 2003 and have run across some link errors. (I have looked at the MS Help articles about LNK2020 errors with mixed-mode C++ and that has not helped)...
10
by: Ian Lazarus | last post by:
Hello. How do "unresolved token" link errors occur. How do I fix them? Linking... LINK : error LNK2020: unresolved token (0A000015) ??_7type_info@@6B@ LINK : error LNK2020: unresolved token...
2
by: DEFENDER | last post by:
Hi .I have problem. I have project width 2 libs When i link my project i have errors some like this : msvcrt.lib(MSVCR71.dll) : error LNK2005: _memmove already defined i LIBCMT.lib(memmove.obj)...
0
by: Roland | last post by:
Hi, ultimately I want to call some unmanaged C++ class that contains some DirectShow code of mine from my C# classes, but for the time being I'd be happy if I could get this to build! I have...
2
by: tllee | last post by:
I wrote a simple stack program using class template on VC++ 2003 but am unable to resolve the following link errors: LINK : error LNK2020: unresolved token (0A000046) Stack.__dtor LINK : error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.