我知道标题有些愚蠢,但我不知道如何问其他问题。 我试图在我的头文件(
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 表现得如此奇怪? 提前感谢您的回答!
问题是 funcdef.c 中的几个语法错误导致无法将其与 main.c 链接
语法错误主要是ANSI C中的C++代码,tcc可以容忍,gcc讨厌。 ^^