Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Defining global variables in MS VC++

  • 29-04-2007 03:04AM
    #1
    Closed Accounts Posts: 2,349 ✭✭✭


    My project's getting too big so I'm splitting it.

    I have a class that's used by a few functions in the main file so it's defined globally (outside the functions), but when I move this code to another file I can't access that class any more.

    Is there a way to make this a truly Global variable, across all files?


Comments

  • Registered Users, Registered Users 2 Posts: 1,481 ✭✭✭satchmo


    Have a read up on the extern keyword, that's for doing what you want.


  • Closed Accounts Posts: 2,349 ✭✭✭nobodythere


    Cheers, figured it out soon after posting from old source code. Who woulda thunk that I already knew it!


Advertisement