我尝试包含几乎所有标题组合。尝试使用以下方法编译目标文件:
gcc database.c -c
gcc database.o user_interface.c -o database
Run Code Online (Sandbox Code Playgroud)
结果是:
/tmp/ccWfp2tS.o: In function `addRecord':
user_interface.c:(.text+0x4b9): multiple definition of `addRecord'
database.o:database.c:(.text+0x0): first defined here
/tmp/ccWfp2tS.o: In function `printAllRecords':
user_interface.c:(.text+0x54a): multiple definition of `printAllRecords'
database.o:database.c:(.text+0x1a): first defined here
/tmp/ccWfp2tS.o: In function `findRecord':
user_interface.c:(.text+0x590): multiple definition of `findRecord'
database.o:database.c:(.text+0x24): first defined here
/tmp/ccWfp2tS.o: In function `deleteRecord':
user_interface.c:(.text+0x5ed): multiple definition of `deleteRecord'
database.o:database.c:(.text+0x36): first defined here
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
用户界面.c
#include "record.h"
int debugmode;
int main(int argc, char *argv[])
{ …Run Code Online (Sandbox Code Playgroud) 我正在开发一个发送 TCP 标头的程序(模拟 3 次握手)。我有一个变量,该变量包含数据偏移量(3 位)、保留值(4 位)和 9 个标志(9 位)。我正在使用按位运算来设置位。问题是如何打印每个位?
如何打印这 3 位?多变的:
u_int16_t reserved_ofs_flags;
Run Code Online (Sandbox Code Playgroud)
我发现这个问题类似,但答案只适用于最不重要的问题:如何打印一位?