ANSI C 二级包含

问题描述 投票:0回答:1

我知道标题有些愚蠢,但我不知道如何问其他问题。 我试图在我的头文件(

stdio.h
)中包含一个标准库(
string.h
head.h
),然后由我的
main.c
脚本包含。

在我的 Windows 7 x64 TCC (http://bellard.org/tcc/) 上一切正常,但学院的 solaris(我不知道,但它是严重的石料)gcc 4.0.2(显然是 2005)只是没有不要...(我收到“未定义符号”错误等)

main.c(摘录):

#include "head.h"

head.h(摘录):

// include librarys
#include <stdio.h>      // standard input/output
#include <string.h>     // operations on strings
#include <locale.h>     // unicode string output

makefile(完整):

CX = tcc
IN = funcdef.o main.o

outfile: ${IN}
${CX} -o outfile.out ${IN}

funcdef.o: head.h funcdef.c
main.o: head.h main.c

我做错了什么?为什么当 TCC 不是 :D 时 GCC 表现得如此奇怪? 提前感谢您的回答!

c makefile include ansi-c
1个回答
0
投票

问题是 funcdef.c 中的几个语法错误导致无法将其与 main.c 链接

语法错误主要是ANSI C中的C++代码,tcc可以容忍,gcc讨厌。 ^^

© www.soinside.com 2019 - 2024. All rights reserved.