user-0 提问: 用C编写代码的时候出现    [Error] ld returned 1 exit status   问题，应该如何解决？求大神指导。

回复:
user: user-1
content: 这样试试 int main() { 	AMGraph G; 	printf("欢迎进入学校超市选址问题："); 	Migraph graph; 	graph.CreatAiMGraph(&G); 	graph.ShortestPath_Floyd(&G); 	return 0; }  单步调试和设断点调试（VS IDE中编译连接通过以后，按F10或F11键单步执行，按Shift+F11退出当前函数；在某行按F9设断点后按F5执行停在该断点处。）是程序员必须掌握的技能之一。

user: user-0
content: 非常感谢，那个问题已经解决了，但是程序运行的时候，输入单位名称后出现这个问题，应该如何解决？可以帮忙看一下么？

user: user-1
content: CreatAiMGraph和ShortestPath_Floyd这2个函数如果是Migraph类的成员函数的话，你实现的时候不能写成： void CreatAiMGraph(AMGraph *G)这样，要改成： void Migraph::CreatAiMGraph(AMGraph *G) PS:类定义也移到函数的上面去  #include<stdio.h> #include<stdlib.h>  #define TURE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define OVERFLOW -1 const int MaxInt = 32767; const int MVNum = 100;  typedef char VerTexType; typedef int ArcType; typedef struct { 	VerTexType vexs[MVNum];     //单位名称；  //? 	ArcType dis[MVNum][MVNum];  //单位间的长度； 	int adj[MVNum][MVNum];      //单位间是否相通； 	int f[MVNum];               //各单位去超市的频率； 	int vexnum, arcnum;          //图当前的点数及边数；  }AMGraph;  class Migraph { public: 	void CreatAiMGraph(AMGraph *G); 	void ShortestPath_Floyd(AMGraph *G); };  void Migraph::CreatAiMGraph(AMGraph *G) { 	int i, j, k;  	printf("请输入单位个数：\n"); 	scanf("%d", &(G->vexnum));  	printf("请输入单位之间的路径数：\n"); 	scanf("%d", &(G->arcnum));  	printf("请输入单位名称：\n"); 	for (i = 0; i<G->vexnum; i++) 	{ 		printf("请输入第%d个单位的名称：", i + 1); 		scanf("%s", &G->vexs[i]);  //? 	}  	for (i = 0; i<G->vexnum; i++)      //结构体初始化； 	for (j = 0; j<G->vexnum; j++) 	{ 		G->adj[i][j] = 0; 		G->dis[i][j] = 0; 		G->f[i] = 0; 	}  	for (k = 0; k<G->arcnum; k++)  //录入单位之间的信息  	{ 		printf("请输入相通的两单位(eg:i,j)：\n"); 		scanf("%d,%d", &i, &j); 		printf("请输入相通两单位之间的距离(eg:dis):"); 		scanf("%d", &G->dis[i][j]);	//? 		G->adj[i][j] = 1; 		G->adj[j][i] = 1; 		G->dis[j][i] = G->dis[i][j]; 	}  	for (k = 0; k<G->vexnum; k++)	//录入单位去超市的频率  	{ 		printf("请输入第%d个单位去超市的相对频率：\n", k); 		scanf("%d", &(G->f[k])); 	}  	for (i = 0; i<G->vexnum; i++) 	for (j = 0; j<G->vexnum; j++) 	{ 		G->dis[i][j] *= G->f[i]; 		if (G->adj[i][j] == 0 && i != j) 			G->dis[i][j] = MaxInt; 	}  }  void Migraph::ShortestPath_Floyd(AMGraph *G) { 	int D[MVNum][MVNum], Path[MVNum][MVNum]; 	int i, j, k, pre; 	int count[MVNum]; 	for (i = 0; i<G->vexnum; ++i)            //初始化  	for (j = 0; j<G->vexnum; ++j) 	{ 		D[i][j] = G->dis[i][j]; 		if (D[i][j]<MaxInt) 			Path[i][j] = i; 		else 			Path[i][j] = -1; 		count[i] = 0; 	} 	for (k = 0; k<G->vexnum; ++k)	//运算步骤  	for (i = 0; i<G->vexnum; ++i) 	for (j = 0; j<G->vexnum; ++j) 	if (D[i][k] + D[k][j]<D[i][j]) 	{ 		D[i][j] = D[i][k] + D[k][j]; 		Path[i][j] = Path[k][j]; 	} 	printf("Floyed算法求解如下：\n"); 	for (i = 0; j<G->vexnum; i++) 	for (j = 0; j<G->vexnum; j++) 	{ 		if (i != j) 		{ 			printf("%d->%d;", i, j); 			if (D[i][j] == MaxInt) 			{ 				if (i != j) 					printf("不存在路径\n"); 			} 			else 			{ 				printf("路径长度为：%d\n", &D[i][j]); 				printf("路径为：%d*", i); 				pre = Path[i][j]; 				while (pre != -1) 				{ 					printf("%d\n", pre); 					pre = Path[pre][j]; 				} 				printf("%d", j); 			} 		} 	} 	for (i = 0; j<G->vexnum; i++) 	for (j = 0; j<G->vexnum; j++) 	{ 		if (D[i][j] == MaxInt) 			count[i] = 0; 		else 			count[i] = 1; 	} 	for (i = 0; i<G->vexnum; i++) 	if (count[i]) 	{ 		for (j = 0; j<G->vexnum; j++) 		if (i != j) 			D[i][i] += D[j][i]; 	} 	k = 0; 	for (i = 0; i<G->vexnum; i++) 	{ 		if (count[i]) 		if (D[k][k]>D[i][i]) 			k = i; 	}  }   int main() { 	AMGraph *G; 	printf("欢迎进入学校超市选址问题："); 	Migraph graph; 	graph.CreatAiMGraph(G); 	graph.ShortestPath_Floyd(G); 	return 0; }