VC++连接错误!

来源:百度知道 编辑:UC知道 时间:2024/05/05 09:05:14
--------------------Configuration: fdf - Win32 Debug--------------------
Linking...
fdfdf.obj : error LNK2001: unresolved external symbol "struct student * stu" (?stu@@3PAUstudent@@A)
Debug/fdf.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

fdf.exe - 1 error(s), 0 warning(s)

这是什么错误!???
#include "iostream.h"
struct student
{

int number;
char name[10];
int sorce;
}stu[],temp;
void main()
{
int i,j;
int n;
cout<<"input how many student:"<<endl;
cin>>n;

for(i=0;i<n;i++)
{
cout<<"student"<<i+1<<":"<<endl;
cout<<"input student number:"<<endl;
cin>>stu[i].number;
cout<<"input student name:"<<endl;
cin>>stu[i].name;
cout<<"input studen

struct student
{

int number;
char name[10];
int sorce;
}stu[],temp;

这里的 stu 不能用 [] 因为编译编译器不知道结构数组的大小 改成

struct student
{

int number;
char name[10];
int sorce;
}stu[100],temp;

要赋值才能用 [] 的

在程序头加
#include "windows.h"
然后再把结构该成:
struct student
{
.......
};
student stu[],temp;
试试
或改成
class student
{
........
};
student stu[],temp;
效果和struct一样

具体程序....