为啥会出error LNK2001: Unsolved external symbol ?
有2个问题
1
在头文件里面声明1个结构体
LSQAStat.h
struct _RunStatusInfo
{
int Index; //operation type index
SVTString tstName; //tstName ---most common operations
int count; //loop
float sum; //response time sum
float min; //min response time
float max; //max response time
float sleep; //sleep time(unused)
int err_cnt; //error counter
int exec_cnt; //executr counter
} ;
然后在CPP文件里面
首先
struct _RunStatusInfo statusinfo[20];//20种不同但类似的操作.
再LSQAStat::LSQAStat(void)
{
//初始化该结构体就不会出错,
}
但是如果我想把struct _RunStatusInfo statusinfo[20];放进该构造函数就会抛
error LNK2001: Unsolved external symbol "struct_RuinStatusInfo *statusInfo" ......
fatal error Link1120:1 unresolved externals
这个是咋回事呢?
2 我如何起LSQAStat为1个且仅仅1个Instance,每隔10分钟起来读该结构体数组,并且写入文件(可能需要加锁?),写点别的进程来不断更改statusinfo[20]的每个结构体数组的值.
为了能在别的进程源码里面取的那些count/max等值,我该如何设计LSQAStat这个类以及
statusinfo[20]这个结构体?
这个LSQAStat就是为了能定时把一些统计信息取出来而设计的.
大家帮忙给点建议啊?