473,387 Members | 1,348 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,387 software developers and data experts.

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_manager {
protected:

static aule_window_manager * application_window_manager;
static std::map<char *, aule_window_manager *identifier_map; <-
this one
static std::map<HWND, aule_window_manager *handle_map; <- and
this one

.... etc

Robin.

Sep 8 '06 #1
3 2370
rs*******@sympatico.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*******@sympatico.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_manager {
protected:

static aule_window_manager * application_window_manager;
static std::map<char *, aule_window_manager *identifier_map; <-
this one
static std::map<HWND, aule_window_manager *handle_map; <- and
this one

... etc

Robin.
Sep 8 '06 #3


rs*******@sympatico.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_manager {
protected:

static aule_window_manager * application_window_manager;
static std::map<char *, aule_window_manager *identifier_map; <-
this one
static std::map<HWND, aule_window_manager *handle_map; <- and
this one
Looks like the symbol "aule_window_manager" 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.learn.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
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
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...
2
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...
5
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...
25
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...
25
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...
8
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...
23
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...
55
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.