【发布时间】:2015-06-12 11:16:28
【问题描述】:
我在 /Users/koraytugay
下有这 3 个文件checksum.h
enc.h
libsec.a
libsec.a 是 checksum.o 和 enc.o 的存档文件
Korays-MacBook-Pro:~ koraytugay$ nm libsec.a
libsec.a(enc.o):
0000000000000090 s EH_frame0
0000000000000000 T _enc
00000000000000a8 S _enc.eh
U _strlen
libsec.a(checksum.o):
0000000000000078 s EH_frame0
0000000000000000 T _checkSumFor
0000000000000090 S _checkSumFor.eh
Korays-MacBook-Pro:~ koraytugay
这就是我尝试编译 hello.c 文件的方式:
Korays-MacBook-Pro:HelloWorld koraytugay$ gcc hello.c -L/Users/koraytugay -libsec -o koko.out
hello.c:4:10: fatal error: 'enc.h' file not found
#include <enc.h>
^
1 error generated.
我做错了什么?
顺便说一句,你好.c:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <enc.h>
#include <checksum.h>
// code here..
【问题讨论】:
-
我认为是因为编译器找不到名为
enc.h的文件... -
Err... 没有为 enc.h 提供有效路径?
-
了解 include 和 include "" 之间的区别。 enc.h 和 checksum.h 应该包含 ""。
-
@cup 我认为标题与
hello.c不在同一个文件夹中。 -
@SeanBright 好主意。太棒了。
标签: c linker include include-path