Save User Params Question

Discussion to talk about software related topics only.
Post Reply
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Save User Params Question

Post by seulater »

NB gives us an example of how to save user paramters to flash.
it works well, however i need to declare it globally. i have other included files that i would like to access *pData. i have tried and googled but not having much luck in doing so.

Below is the code snipped from that exmple. I just need to access *pData from another *.cpp file.


Code: Select all

struct NV_SettingsStruct
{
      DWORD VerifyKey;
      WORD  nvWord;
      char  nvChar;
      BYTE  nvByte;
};
NV_SettingsStruct NV_Settings;

NV_SettingsStruct *pData = ( NV_SettingsStruct * ) GetUserParameters();
stevep
Posts: 16
Joined: Fri Apr 25, 2008 6:34 am

Re: Save User Params Question

Post by stevep »

Declare pData as extern in the other cpp files where you want to access it.

Code: Select all

extern NV_SettingsStruct *pData;
seulater
Posts: 445
Joined: Fri Apr 25, 2008 5:26 am

Re: Save User Params Question

Post by seulater »

ya, tired that an i get this error.

"expected initializer before '*' token"
stevep
Posts: 16
Joined: Fri Apr 25, 2008 6:34 am

Re: Save User Params Question

Post by stevep »

The second .cpp file can't get to the structure definition. Try moving the definition to the header and then #include it in the second .cpp.
Post Reply