Click here to Skip to main content
16,012,168 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A tricky one :o) Pin
Nick Parker29-Dec-02 16:49
protectorNick Parker29-Dec-02 16:49 
GeneralRe: A tricky one :o) Pin
Nick Parker29-Dec-02 16:45
protectorNick Parker29-Dec-02 16:45 
GeneralRe: A tricky one :o) Pin
RaulGonzalez29-Dec-02 16:50
RaulGonzalez29-Dec-02 16:50 
GeneralRe: A tricky one :o) Pin
Nick Parker29-Dec-02 17:12
protectorNick Parker29-Dec-02 17:12 
GeneralRe: A tricky one :o) Pin
RaulGonzalez29-Dec-02 17:36
RaulGonzalez29-Dec-02 17:36 
GeneralClosing only one of several documents Pin
trimtrom29-Dec-02 16:10
trimtrom29-Dec-02 16:10 
GeneralRe: Closing only one of several documents Pin
Michael Dunn29-Dec-02 16:41
sitebuilderMichael Dunn29-Dec-02 16:41 
GeneralStatic Memeber Problem Pin
29-Dec-02 14:31
suss29-Dec-02 14:31 
ABC.H:
------
class ABC
{
public:
static void print_rows_columns();
static void initialise_rows_columns(int rows, int columns);
ABC(bool flag1, bool flag2,int number);
virtual ~ABC();
protected:
static int total_columns;
static int total_rows;
bool flag1;
bool flag2;
int number;
};
---------------------------------------
ABC.CPP

ABC::ABC(bool f1,bool f2,unsigned int idn )
{
flag1=f1;
flag2=f2;
number=idn;
}

ABC::~ABC(){}

static void ABC::initialise_rows_columns(int rows, int columns)
{
total_rows=rows;
total_columns=columns;
}

static void ABC:: print_rows_columns()
{
cout<<"Rows:"<<total_rows;
cout<<"\n="" columns:"<<total_columns<<endl;

}
--------------------------------------------------------------------
main.cpp
---------
#include="" "abc.h"

void="" main()
{
="" abc="" my_abc;
="" int="" rows,="" columns;
="" cout<<"please="" give="" the="" number="" of="" rows:";
="" cin="">>rows;
cout<<"\n Please give the number of Columns:";
cin>>columns;
ABC::initialise_rows_columns(rows,columns);
ABC::print_rows_columns();

}
===============================================================Cry | :(( Cry | :((
The Errors I get are listed Below:
=======================================================================

I have two static protected member variables in my class.
To initialize them with user input I made a static function to access them.
I call this static member function in my main function for initialization purpose.
But I get link errors when I rebuild my whole project where can I be wrong??
Following are the errors:
ABC.obj : error LNK2001: unresolved external symbol "protected: static int ABC::total_columns" (?total_columns@ABC@@1HA)
ABC.obj : error LNK2001: unresolved external symbol "protected: static int ABC::total_rows" (?total_rows@ABC@@1HA)
Main.obj : error LNK2001: unresolved external symbol "public: __thiscall ABC::ABC(void)" (??0ABC@@QAE@XZ)
Debug/XYZ.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.


Cry | :(( Cry | :((
GeneralRe: Static Memeber Problem Pin
Nitron29-Dec-02 15:02
Nitron29-Dec-02 15:02 
GeneralRe: Static Memeber Problem Pin
Michael Dunn29-Dec-02 16:04
sitebuilderMichael Dunn29-Dec-02 16:04 
GeneralMaking folder invisible (advanced) Pin
Member 20681029-Dec-02 14:11
Member 20681029-Dec-02 14:11 
GeneralRe: Making folder invisible (advanced) Pin
Andreas Saurwein30-Dec-02 6:58
Andreas Saurwein30-Dec-02 6:58 
QuestionCould someone please guide me with my code a litlle? Pin
georgiek5029-Dec-02 13:58
georgiek5029-Dec-02 13:58 
GeneralNew to Programming Pin
bmwmpower29-Dec-02 13:21
bmwmpower29-Dec-02 13:21 
GeneralRe: New to Programming Pin
Taka Muraoka29-Dec-02 13:31
Taka Muraoka29-Dec-02 13:31 
GeneralRe: New to Programming Pin
Rob Graham29-Dec-02 13:59
Rob Graham29-Dec-02 13:59 
GeneralRe: New to Programming Pin
berdj@sympatico.ca31-Dec-02 13:28
sussberdj@sympatico.ca31-Dec-02 13:28 
GeneralRe: New to Programming Pin
(Steven Hicks)n+129-Dec-02 15:54
(Steven Hicks)n+129-Dec-02 15:54 
GeneralKiss for free books Pin
Linda1029-Dec-02 12:03
Linda1029-Dec-02 12:03 
GeneralRe: Kiss for free books Pin
zarzor29-Dec-02 12:19
zarzor29-Dec-02 12:19 
GeneralRe: Kiss for free books Pin
Jim Crafton29-Dec-02 13:03
Jim Crafton29-Dec-02 13:03 
GeneralRe: Kiss for free books Pin
Taka Muraoka29-Dec-02 13:33
Taka Muraoka29-Dec-02 13:33 
GeneralRe: Kiss for free books Pin
Linda1029-Dec-02 14:41
Linda1029-Dec-02 14:41 
GeneralRe: Kiss for free books Pin
Taka Muraoka29-Dec-02 15:09
Taka Muraoka29-Dec-02 15:09 
GeneralRe: Kiss for free books Pin
Nick Parker29-Dec-02 16:39
protectorNick Parker29-Dec-02 16:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.