There are two ways to deal with this. One is to put the word "extern" in front of the declarations in the header file and then in one and ONLY one place (main.cpp most likely) add those declarations again without the "extern" in front of them.
The second option is to do this -
In the header file :
#define GLOBAL extern
// define structures here ...// now declare instances
GLOBAL circles cl;
GLOBAL polygon pg;
Then in just ONE of the .cpp files, again like main.cpp, do this :
This scheme can work with virtually any global variables if you really need to use them.
If you have an unresolved external error from the linker then you did not do what I said to exactly. Copy and paste the two definitions I showed in the previous post and put them where I said they need to go and it should work fine. I have used this technique for a long time with several different compilers and not had any problems.
It is not a good idea to create global variables inside a header file.
So create a shapes.cpp file and put the global variables inside them.
In the shapes.h header file put the extern keyword before the global variable creation statement as mentioned in the other posts.
«_Superman_» I love work. It gives me something to do between weekends.
Is this a "feature" of VC 6.0 only?
The associated list box puts the scroll bar on the right and aligns the text on right also.
Now the user have to select the list box from left and select from the list box on right.
It is not a major problem, but...
Only constructive comments to the subject will be appreciated.
No lectures please.
as i know and read some where there i found if file is created through admin then generally limited user cann't write in file.Ony Limited user have read permission.So can i change file attribute for limited user or there is any rule for create a file for all user read and write permission then please help me.
i am trying to use parallel port to send data to it using vc++, i have added LED's to know if it works fine.
I have included inpout32.dll in my system32 directory and inpout32.lib is linked to my project, i have even placed inpout32.dll at my projects directory.
When the project executes, it gives no error, but output doesnot appear at LEDs.
please let me know if there are any errors in my code below, or anything that can help me to see output
void _stdcall Out32(short PortAddress, short data);
Never having used Out32()... Have you verified that 0x378 is the correct address of the parallel port on your machine (and it is enabled)? Have you ruled out hardware problems, LED's that are backwards, ground(s) not connected...
Last Visit: 31-Dec-99 19:00 Last Update: 3-Mar-24 2:45