编译时遇到no such file or directory

starecho147 starecho147 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在学数据结构 想用STACK处理一个 符号匹配的问题

编译的时候总碰到说stack_link.h或者是fatal.h no such file or directory
但我确定把头文件都放到一个文件夹里了

还有就是 #include后面 用“ ” 和用< >效果不一样的 ms “”就可以 <> 就通不过..

我用的是C-Free

代码如下

stack_link.h

#ifndef _Stack_h
#define _Stack_h

struct Node;
typedef struct Node *PtrToNode;
typedef PtrToNode Stack;

int IsEmpty( Stack S );
Stack CreateStack( void );
void MakeEmpty( Stack S );
void Push( ElementType X, Stack S );
void Pop( Stack S );

#endif /* _Stack_h */

——————————————————————
fatal.h
#include <stdio.h>
#include <stdlib.h>

#define Error( Str ) FatalError( Str )
#define FatalError( Str ) fprintf( stderr, "%s\n", Str ), exit( 1 )

——————————————————————————————————


#include <stdio.h>
#include <stdlib.h>
#include <fatal.h>
#include "stack_link.h"

struct Node{
int a;
PtrToNode Next;
};

Stack CreateStack(void){
Stack S;

S = malloc(sizeof(struct Node));
if(S==NUll) FatalError("Out of Space!!");
MakeEmpty(S);
return S;
}

void MakeEmpty(Stack S){
if (S==NULL) Error("Must CreateStack first!");
else
while(!IsEmpty(S))
Pop(S);
}

int IsEmpty(Stack S)
return S->Next == Null;

void Pop(Stack S){
PtrToNode Fst;

if(IsEmpty(S)) Error("Empty Stack!!");
else{
Fst = S->Next;
S->Next= S->Next->Next;
free(Fst);
}
}

void Push(int x,Stack S){
PtrToNode Tmp;

Tmp = malloc(sizeof(struct Node));
if(Tmp == Null) FatalError("Out of space!!");
else{
Tmp->a = x;
Tmp->Next = S->Next;
S->Next = Tmp;
}
}

int main() /*Balancing Symbols*/
{
char c;

while((c=getchar())!='\n'){
if (c=='('||c=='['||c=='{')
Push(c,S);
else if(c==')'||c==']'||c=='}'){
if(IsEmpty(S)) printf("wrong order!");
else{ /*S is OK*/
if(Top(S)!=c) printf("wrong order!");
else
Pop(S);
}
}
}
if(!IsEmpty(S)) printf("wrong order!");
}
...全文

相关推荐

64位linux 编译c提示gnu/stubs-32.h:No such file or directory的解决方法

64位linux提示gnu/stubs-32.h:No such file or directory的解决方法 这个问题是由于缺少32位兼容包,解决办法: ubuntu: sudo apt-get install libc6-dev-i386 CentOS:yum -y install glibc-devel.i686 Re阿里云yum源没有glibc.i686 阿里云的64位Linux发行版屏蔽了32位,也就是常见的i686软件包的数据源,你可以修改yum的配置文件/etc/yum.conf,找到其中exclude=*.i?86 kernel kernel-xen kernel-debu

weixin_38556394

深入理解linux执行文件提示No such file or directory的背后原因

主要介绍了深入理解linux执行文件提示No such file or directory的背后原因,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

weixin_38502639

libx11_1.6.7.orig.tar.gz

交叉编译libX11库,X11/X11.h: No such file or directory

zengxy203

C++-filesystem file not found.pdf

c++ C++_filesystem file not found的解决办法

极智视界

C语言头文件引用问题[项目代码]

本文详细解释了C语言中头文件引用时出现的常见错误“fatal error: .h: No such file or directory”的解决方法。通过将代码中的`#include <xxx>`改为`#include "xxx"`可以解决该问题。文章进一步分析了`""`和`<>`在引用头文件时的区别,包括引用的头文件不同、用法不同、调用文件的顺序不同以及预处理程序的指示不同。最后,作者总结了这一问题的原因,并鼓励读者点赞或评论支持。

wdx012345
评论 10
收藏 已收藏
分享
返回顶部
starecho147
C语言 70,039 成员 243,237 内容