编译时遇到no such file or directory
编译的时候总碰到说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
深入理解linux执行文件提示No such file or directory的背后原因
主要介绍了深入理解linux执行文件提示No such file or directory的背后原因,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
libx11_1.6.7.orig.tar.gz
交叉编译libX11库,X11/X11.h: No such file or directory
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"`可以解决该问题。文章进一步分析了`""`和`<>`在引用头文件时的区别,包括引用的头文件不同、用法不同、调用文件的顺序不同以及预处理程序的指示不同。最后,作者总结了这一问题的原因,并鼓励读者点赞或评论支持。


