Results 1 to 2 of 2

Thread: what's up with static members?

  1. #1
    Aragorn
    Guest

    what's up with static members?

    Hi to all of you.

    I'm trying to use a static variable in my class which is defined in a header file. The problem is that the linker won't let me do it like this:
    Code:
    Error: Unresolved external 'Cell::Parent' referenced from C:\C++\NETWORK\NNMAIN.OBJ
    The class is something like this:
    Code:
    // file: nnetwork.h
    
    class Cell {
    private:
       static another_class* Parent;
       //stuff...
    
    public:
       SetParent(another_class*);
       //stuff...
    };
    which is #included in nnmain.cpp
    Code:
    // file: nnmain.cpp
    
    #include "nnetwork.h"
    I would like to know the right way to link many source files into a single executable (no dlls). Maybe i should also know the way to separate the source correctly, because this is not the first time i get this kind of errors (also when using extern) and i don't know how to solve it.

    Thanks

  2. #2
    Aragorn
    Guest

    Exclamation oops!

    ops!
    sorry, i corrected the error with the explanations on the other thread about "static". However i still get errors when i try to use extern variables.
    Could someone give me a brief explanation about linkage scope and available modifiers?
    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width