大家早上好。
我在这里是新的,所以我问这个问题,因为我必须重新调整我昨天的algorithm和编程的考试。 在CodeBlocks上input我的考试时,我收到了一个我无法修复的错误。 基本上,考试要求从数据结构中的文件(格式:char * namecity,int population,int distance)中加载一些信息,然后要求计算每个城市的相互距离并将其收集到另一个数据中结构体。 我决定做2个ADT:第一个在我的库“vett.h”中定义:
#ifndef VETT_H_INCLUDED #define VETT_H_INCLUDED #include "List.h" typedef struct vett { char nome[21]; int abitanti,dist; lista_t List; } Item; Item *vectinit(int N,Item *v); Item *vectInsert(Item *v,char *nome,int people,int dist,int i); #endif // VETT_H_INCLUDED
我根据老师的教训做了一个“差不多ADT”或者“二等ADT”(R.Sedgewick)。 这样做,主要可以为该结构创build一个数组,并可以直接访问该结构的字段; 每个“单元格”包含:城市名称,人口,距离和列表types字段。 问题从这里开始。 为了计算和保存城市的相互距离,我决定在名为“List.h”的库中创build另一个ADT列表,types为1st类。
#ifndef LIST_H_INCLUDED #define LIST_H_INCLUDED #include "vett.h" typedef struct lista *lista_t; lista_t calculateMutualdistance(lista_t List,Item *v,int N,int dist); int chechForBetter(int SD,int i,Item *v); lista_t listinit(lista_t List,int N); #endif // LIST_H_INCLUDED`
Vala找不到gtk + -3.0 Ubuntu 12.04
GAE转到Windows – “无法运行程序”,“不是有效的Win32应用程序”
装了Mingw64但是不能编译64bit的代码
如何在使用MinGW静态构buildQt 5.7时如何解决此构build错误?
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "List.h" typedef struct node *Node; struct node { char destination[21]; int distance; Node next; }; struct lista { Node head,tail; }; (...)
现在我从CodeBlocks得到这个错误(在vett.h,第9行,在int abitanti,int dist之后):
但为什么? lista_t被包含在List.c文件中,并且应该从“vett.h”完全可见,因为我包含了“List.h”,并且指针在“List.c”中find了它的结构,它获得了“List.h”也包括在内!
希望有人能向我解释,因为我只有2天的时间来调整程序并使其工作,这是相当大的。 感谢您的关注和抱歉,我的语法错误,因为你可以告诉我不是英语。 祝你今天愉快!
未定义的引用c ++,不寻常的情况
无法在Linux Mint 15中编译简单的c程序
在C中strtok_r和strtok_s有什么区别?
configuration:错误:C预处理器无法进行健全性检查
问题返回CArray
这通常是前向声明的问题。 就像这样改变你的List.h文件:
#ifndef LIST_H_INCLUDED #define LIST_H_INCLUDED typedef struct vett Item; typedef struct lista *lista_t; lista_t calculateMutualdistance(lista_t List,int N); #endif // LIST_H_INCLUDED`
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。