473,325 Members | 2,828 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,325 software developers and data experts.

unresolved external

I'm trying to write an RAS class on windows ad RasDial's callback
function requires it to either not be a class member or for it to be
static. I went for the static option so in the header file I declared an
extern variable for the class outside of the class definition so I
could use it in the static function, like so:

#ifndef RasClientH
#define RasClientH

#include <ras.h>
#include <raserror.h>

class RasClient
{
[snip]
};

extern RasClient ras;

#endif

then in the header file for the class I will be using ras in I put:

#ifndef MainFormH
#define MainFormH

#include "RasClient.h"

[snip]

class TfrmMain : public TForm
{
[snip]
private: // User declarations
RasClient ras;
[snip]
};

#endif

but when it's linking I'm getting an error saying '[Linker Error]
Unresolved external '_ras' referenced from RASCLIENT.OBJ'. Can anyone
tell me what I'm doing wrong?

TIA
Dec 12 '05 #1
3 1708
Mark wrote:
I'm trying to write an RAS class on windows ad RasDial's callback
function requires it to either not be a class member or for it to be
static. I went for the static option so in the header file I declared an
extern variable for the class outside of the class definition so I
could use it in the static function, like so:

#ifndef RasClientH
#define RasClientH

#include <ras.h>
#include <raserror.h>

class RasClient
{
[snip]
};

extern RasClient ras;

This extern declaration tells the compiler that a global object
with name ras exists. It does not define (instantiate) it.
You do not instantiate it anywhere in the code you showed.
Just add

RasClient ras;

in one of your implementation files. That should solve your linker
problem, but I'm not sure it's really what you want to do.

Stephan

Dec 12 '05 #2
Stephan Hoffmann wrote:
This extern declaration tells the compiler that a global object
with name ras exists. It does not define (instantiate) it.
You do not instantiate it anywhere in the code you showed.

[snip]

So declare it outside of a class definition?

Mark
Dec 12 '05 #3

"Mark" <us**@site.com> wrote in message
news:43********@news.comindico.com.au...
| Stephan Hoffmann wrote:
| > This extern declaration tells the compiler that a global object
| > with name ras exists. It does not define (instantiate) it.
| > You do not instantiate it anywhere in the code you showed.
| [snip]
|
| So declare it outside of a class definition?
|
| Mark

No, define it outside the class definition.
Dec 12 '05 #4

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

Similar topics

4
by: Rodolphe | last post by:
Hello, I'm French so sorry for my approximate English. When I try to compile a project under Visual C++ 6.0, I've got the following errors : applicap.obj : error LNK2001: unresolved external...
0
by: Ida | last post by:
Hi, I am trying to build an dll with Microsoft Visual C++ but during the linking phase I get linking errors. Script.obj : error LNK2019: unresolved external symbol __imp__PyString_AsString...
1
by: Aravind | last post by:
we have two files: 1. rc4.c (defines one function "create_pin()") 2. MyImpl.c(calling the function "create_pin()"),This implements JNI method. 1.When I am trying to create .dll file with one...
5
by: cschettle | last post by:
I think you need to link with msvcrt.lib ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
2
by: Maydogg6 | last post by:
I need a hand with some stubborn link errors. I'm trying to recreate and old program from 6.0 into .NET, but for some reason when I try to compile I'm getting linking errors for all my function...
6
by: sadegh | last post by:
Hi I have a problem with my program in VC++6 When I compile it, the following errors are listed. I spend a lot of time on the groups.google.com to find its reason, but none of comments could...
5
by: bonnielym84 | last post by:
Im new here..didnt noe whether is this the rite way to post my problem..Really need help here..i've been stucked in this error from last wk..My problem is like this..Im using VC++ 6.0 to compile my C...
0
by: Ryan Gaffuri | last post by:
hlink72@hotmail.com (Eric) wrote in message news:<ab8d8b14.0308220550.54fb5f22@posting.google.com>... LNK1120 is a standard C++ error. you using Visual C++? Means your references a class that...
2
by: =?Utf-8?B?YmFzaA==?= | last post by:
Hello, I am compiling a CPP code using Visual studion .net 2003. I get the following error, despite having windldap.h and wldap32.dll in my include and lib paths. Here is the error. uuid.lib...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.