when extern storage class is called, could the arrays of structure hold multiple instances..
Because this arrays of file1.cc hold neighbor information of nodes (time varying) and when extern is called that behavior is no more there.
Could send 'you' the files .Thanks for your suggestions...
User Profile
Collapse
-
I simply require the array instances in file1.cc to be reflected in file2.cc.
The problem I see is whenever I define extern in file1.h without even trying to retrieve from file2.cc, the values indicated in original arrays of struct go haywire....Leave a comment:
-
Well, I want the file2.cc to be capable of accessing information maintained by arrays in file1.cc.
i.e file1 maintains {id,val} information for each node;and file2 tries to retrieve this information.
Thanks for your questions and suggestions....Leave a comment:
-
What I observe is when declared as extern, it maintains a single instance hence overwrites the array, whereas otherwise it maintains multiple instances giving each value,id pair.
If I'm to elaborate a bit:
This i do to maintain a neighbor table that corresponds to each node, so when
you run file2.cc alone(without extern), each node has it's own neighbor table(with corresponding id,value pair of its neighbors)
when...Leave a comment:
-
I managed to compile it this time, but the ultimate result is the same as I got when I declared extern struct in both the .cc files (like in my first posting)
Thanks...Leave a comment:
-
I still get this error while trying to compile.
file1.h:270: error: storage class specified for ‘myList_’
Thank you...Leave a comment:
-
In fact I want to retrieve file1 data into file2.If I understand your code correctly it does the other way round.
I tried this way and when I compile I get the following error
file1.h:270: error: storage class specified for 'myList_'
Thank you for your suggestions....Leave a comment:
-
I'm working on Linux, and it works normally in #include<direct/file1.h> style.
Could you explain me how could I use, extern with arrays of structure?
Thank you...Leave a comment:
-
well it is not in the current directory, so i specified the path
#include <direct/file1.h>
Yes I tried putting extern declaration in the heade file too(file1.h).St ill doesn't work.
Thanks for your attention....Leave a comment:
-
extern with arrays of structure
Hi,
I tried to share some data between 2 .cc files hence declared the arrays of structure as extern in one of the .cc files.
However I get abnormal entries in the original array entries otherwise I wouldn't have got.
file1.h
---------
struct Mylistdetails {
int id;
int value;
}
file1.cc
----------
struct Mylistdetails myList_[MAX_NO];...
No activity results to display
Show More
Leave a comment: