为什么我的.c文件没有读取我的头文件? [英] Why is my .c file not reading my header file?

查看:147
本文介绍了为什么我的.c文件没有读取我的头文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到的2个错误是:

架构x86_64的未定义符号:

_ main,引自:
隐式条目/启动主可执行文件

ld:找不到架构x86_64的符号

clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)



标题:

the 2 errors i get are :
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

header:

#ifndef fraction_h_
#define fraction_h_

struct fraction{
    int wholeNumber;
    int numerator;
    int denominator;
};

struct fraction fractionCreate(int numerator, int denominator);
struct fraction fractionAdd(struct fraction a, struct fraction b);
struct fraction fractionSubtract(struct fraction a, struct fraction b);
struct fraction fractionMultiply(struct fraction a, struct fraction b);
struct fraction fractionDivide(struct fraction a, struct fraction b);
void fractionPrint(struct fraction f);

#endif

推荐答案

错误消息来自链接器(不是编译器)。它抱怨源文件中缺少 main 函数(它与丢失的头文件无关)。
The error message comes from the linker (not the compiler). It complains about missing main function in your source file(s) (it has nothing to do with missing header file).


这篇关于为什么我的.c文件没有读取我的头文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆