473,770 Members | 6,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

global variables and class statics in a static library


Does anyone know where I can get info on the rules for creating static
libraries in C++ (I am using Visual Studio 6.0)? Or can anyone answer
the following questions:

1. I have globals that are coming up as unresolved in the library test
application:

aule_timer * system_timer;
aule_keyboard * keyboard;

(I seem to have fixed this by specifying them in my main module in the
test app (instead of in the library module where I originally put them
- but an explanation of the rules for this kind of thing would be
useful)

2. I have two static class variables that are also coming up as
unresolved:

class aule_window_man ager {
protected:

static aule_window_man ager * application_win dow_manager;
static std::map<char *, aule_window_man ager *identifier_map ; <-
this one
static std::map<HWND, aule_window_man ager *handle_map; <- and
this one

.... etc

Robin.

Sep 8 '06 #1
3 2402
rs*******@sympa tico.ca wrote:
Does anyone know where I can get info on the rules for creating static
libraries in C++ (I am using Visual Studio 6.0)? Or can anyone answer
the following questions:
[snip]

Yes: in a group dedicated to your compiler/platform. See this FAQ for
what is on-topic here and for a list of other groups you might consider
(http://www.parashift.com/c++-faq-lit....html#faq-5.9).

Cheers! --M

Sep 8 '06 #2

Looks like spaghetti on the screen. I was refering to the two maps.
Both are static class variables.

rs*******@sympa tico.ca wrote:
Does anyone know where I can get info on the rules for creating static
libraries in C++ (I am using Visual Studio 6.0)? Or can anyone answer
the following questions:

1. I have globals that are coming up as unresolved in the library test
application:

aule_timer * system_timer;
aule_keyboard * keyboard;

(I seem to have fixed this by specifying them in my main module in the
test app (instead of in the library module where I originally put them
- but an explanation of the rules for this kind of thing would be
useful)

2. I have two static class variables that are also coming up as
unresolved:

class aule_window_man ager {
protected:

static aule_window_man ager * application_win dow_manager;
static std::map<char *, aule_window_man ager *identifier_map ; <-
this one
static std::map<HWND, aule_window_man ager *handle_map; <- and
this one

... etc

Robin.
Sep 8 '06 #3


rs*******@sympa tico.ca wrote:
Does anyone know where I can get info on the rules for creating static
libraries in C++ (I am using Visual Studio 6.0)?
Library implementations are outside the domain of the language and
this newsgroup. Try a newsgroup that discusses your compiler (see
my signature below).

Or can anyone answer the following questions:

1. I have globals that are coming up as unresolved in the library test
application:

aule_timer * system_timer;
aule_keyboard * keyboard;

(I seem to have fixed this by specifying them in my main module in the
test app (instead of in the library module where I originally put them
- but an explanation of the rules for this kind of thing would be
useful)
Symbols are usually resolved in the latter phases of translation.
Commonly, this is in the linking phase. Perhaps you need to specify
a library or are specifying it incorrectly (e.g. in the wrong order).
Some tools will only parse a library once so the library must be
either later in the list or repeated in the list.

>
2. I have two static class variables that are also coming up as
unresolved:

class aule_window_man ager {
protected:

static aule_window_man ager * application_win dow_manager;
static std::map<char *, aule_window_man ager *identifier_map ; <-
this one
static std::map<HWND, aule_window_man ager *handle_map; <- and
this one
Looks like the symbol "aule_window_ma nager" or "HWND" are not linked
in. Is there _code_ linked in for the symbols and not just the
{class} definitions?

>
Robin.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.l earn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Sep 9 '06 #4

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

Similar topics

16
2986
by: Eric | last post by:
I have a static class member variable as follows: struct A { static void Set (int i) { v = i; } static int& Get () { return v; } static int v; }; int A::v; // define A::v in the cpp file
4
2674
by: Cheng Mo | last post by:
I know global varaibles should always be avoided. I asked this question just for deep insight about C++. If global variables are distributed among different source code files, what's the initialziation sequence of these varaibles. Say, Foo g_fooMain in main.cpp; Foo g_hello in hello.cpp; Foo g_bye in bye.cpp; and main.cpp has code #include "hello.h"
2
1559
by: Gianguz | last post by:
I'd like to discuss about the opportunity to have a global objects creator that introduces into a general framework (suited for multithreading) a controlled semantic to manage globals variables (objects and scalar-types). In the following example Global is able to create objects of any kind with and index value attached to. So a Global<0, string> is a unique string instance object allocated into the system that can be accessed from any...
5
1784
by: Stuart MacMartin | last post by:
I have a problem with static lifetime (order of destruction of statics within different cpp files). I have a workaround that happens to work in my case. I'd like to know if this is luck or required to work. Consider: class A { ... static B m_b; static C& GetC(); };
25
66084
by: Daniel Bass | last post by:
how do i declare a global variable in c#.net? it's like it want's everything in classes... there are times when globals are good, like having constants in a program which apply to several layers/objects/etc... or does it expect me to create a singleton global class structure? surely it's not that terrible.
25
5180
by: Sahil Malik [MVP] | last post by:
So here's a rather simple question. Say in an ASP.NET application, I wish to share common constants as static variables in global.asax (I know there's web.config bla bla .. but lets just say I wanna use global.asax) --- Would you declare your static var as --- public static int x ;
8
5675
by: Thomas Coleman | last post by:
Ok, I've obviously discovered that Global.aspx has been completely changed in ..NET 2.0. However, I haven't figured out how to declare a constant that's available to any page in my application without having to jump through a bunch of hoops. First, let me layout how it worked in 1.1. In the Global.asax, within the Global class construct, I would simply add something like: public const string FOO = "foo";
23
2264
by: David Colliver | last post by:
Hi, using c#, 1.1 I know that we are not supposed to use global variables etc. in c# I am having a problem, but not sure how to resolve. I did have another post here, but may have over confused things, so I will start afresh. An example of what I want to do...
55
6247
by: Zytan | last post by:
I see that static is more restricted in C# than in C++. It appears usable only on classes and methods, and data members, but cannot be created within a method itself. Surely this is possible in C# in some way? Or maybe no, because it is similar to a global variable (with its scope restricted) which C# is dead against? Zytan
0
9592
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10231
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6679
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.