I'm looking to create an array (or vector?) to represent some files.
Basically, I'm going to have a variable number of input files. Each line of each file can be treated as a custom object (I'm calling them each a 'symbol'). There is a variable number of lines in each file.
So I'd like to have this kind of representation going on:
array[x][y]
where x will be referring to the file, and y the line in that file.
I'd seen a few topics on stackoverflow which suggested something along these lines
symbol **snapShots = new symbol*[usableFiles];
for(int i = 0; i < usableFiles; ++i) {
snapShots[i] = new symbol[longestFile];
}
which is giving me an odd error message when building:
Undefined symbols for architecture x86_64:
"symbol::symbol()", referenced from:
_main in MarketDataGenerator.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Info: Parallel threads used: 3
Any ideas how I'd go about this? Or would I just be better storing the information in file temporarily before reading back in for further processing?
Have you considered using std::vector<symbol>
or std::vector<std::vector<symbol> >
? What you linker is trying to tell you, is that you have declared a default constructor for your class symbol
but not defined it (at least not in the files you are linking).