Hello,

While trying to get back into programming, I come across problems. The first one is:

Why can't I work with global variables? Is there a new way of doing the same thing?

Thanks

Recommended Answers

All 4 Replies

To be a little more specific: I get this error message

error: 'global' does not name a type

How about showing us your code?

Sorry :P Here it is

#include <iostream.h>
#include <stdlib.h>

using namespace std;

global int Test;

int main()
{
    Test = 5;
    cout << "Test contains: " << Test;
    return 0;
}

Try taking out the word global. For reference see here and here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.