|
-
October 1st, 2009, 07:09 PM
#15
Re: help with complex struct (or class)
I did a re-install.
This compiles and runs,
Code:
#include <vector>
#include <iostream>
std::vector<int> IntArray(4);
int main()
{
IntArray[0] = 10;
std::cout << IntArray[0];
}
and prints 10 as expected.
This is still not working,
Code:
#include <vector>
#include <iostream>
struct Type2 {
float eVal;
int eCount;
int NumI[50];
int NumJ[50];
int TypeI[50];
int TypeJ[50];
int Ict;
int Jct;
};
struct Type1 {
Type2 type2[100];
};
struct Order {
Type1 type1[100];
};
std::vector<Order> order(4);
int main()
{
order[0].type1[0].type2[30].eVal = 1.0F;
// std::cout << order[0].type1[0].type2[30].eVal << std::endl;
}
It will compile, but I get,
$ ./_test.exe
1 [main] _test 724 _cygtls::handle_exceptions: Error while dumping state (probably corrupted stack)
Segmentation fault (core dumped)
at runtime. I get the error with or without the cout. If I add a test print before the order[0].type1[0] statement, I still get the error, so the program is not able to initialize.
I tried this on a linux box and didn't have any problems, so there is still a local problem here somewhere. It is odd that the simple program worked fine.
LMHmedchem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|