Declaring Static variables

I have now been able to complete up to 4.10 on the cio_test.cpp, but ran into some more problems.  I have declared the _tabsize in the .h file and the .cpp file.  The issue arises when I try calling the test file and it doesn’t seem to find/accept the arguement that is being passed into the function on 680.

I have know been able to pass it, but the compiler doesn’t like the way I am doing it For example I have declared it like this:

static unsigned int _tabsize; //Under public so it can be reached by the main.

And the cpp file like this:

unsigned int Console::_tabsize = 4;

But the compiler still doenst like this and is saying this:

console.cpp:8:32: error: âunsigned int cio::Console::_tabsizeâ is not a static member of âclass cio::Consoleâ

I don’t Know why its doing this or even where to figure it out.  Any help would be greatly appreciated as it is nearing the deadline.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

2 Responses to Declaring Static variables

  1. Bananawaffles says:

    I don’t know if this will help, but I don’t think you need the static in front of the initialization in the cpp file. I tried to put static in front of mine and had a compile error. Also on line 680 that function takes in an int and you made tab an unsigned int. It should only give you a warning, but that’s all I can see wrong.

Leave a comment