global variables and class statics in a static library

Discussion in 'C++' started by rsforster@sympatico.ca, Sep 8, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. mlimber Guest

    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-lite/how-to-post.html#faq-5.9).

    Cheers! --M
     
    mlimber, Sep 8, 2006
    #2
    1. Advertising

  3. Guest

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

    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, 2006
    #3
  4. 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
     
    Thomas Matthews, Sep 9, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason

    Statics and connections

    Jason, Dec 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,765
    Jason
    Dec 6, 2004
  2. SaravanaKumar
    Replies:
    6
    Views:
    9,455
    Tony Morris
    Oct 19, 2004
  3. jose luis fernandez diaz

    Nonlocal Store (global and class static variables)

    jose luis fernandez diaz, Jan 2, 2004, in forum: C++
    Replies:
    8
    Views:
    1,232
    Victor Bazarov
    Jan 6, 2004
  4. Martin
    Replies:
    4
    Views:
    438
    ulrich
    Apr 26, 2005
  5. Stuart MacMartin
    Replies:
    5
    Views:
    569
    Victor Bazarov
    Jul 27, 2005
Loading...

Share This Page