小编use*_*148的帖子

当此程序在Windows上运行时,为什么回车会爬行?

我编写了以下程序,将十六进制字符串转换为相应的二进制数据。

#include <stdio.h>
#include <stdlib.h>

int main(void) {

  char bf[3];
  char b; /* each byte */

  bf[0] = bf[1] = bf[2] = 0;

  for (;;) {
    for (;;) { 
      bf[0] = getchar();
      if (isspace(bf[0])) continue;
      if (bf[0] == EOF) goto end;
      break;
    }

    for (;;) { 
      bf[1] = getchar();
      if (isspace(bf[1])) continue;
      if (bf[1] == EOF) goto end;
      break;
    }

    b = strtoul(bf, NULL, 16);
    //printf("%s = %d\n", bf, b);
    fwrite(&b, sizeof b, 1, stdout);
  }

 end:
  exit(0);
}
Run Code Online (Sandbox Code Playgroud)

这是一个测试文件: …

c windows carriage-return

3
推荐指数
1
解决办法
68
查看次数

为什么LDFLAGS将我的库放在生成未定义引用的目标文件之前?

这是发生了什么.

$ LDFLAGS=-ltestu01 make exemplo
cc   -ltestu01  exemplo.c   -o exemplo
/home/melba/tmp/ccO2KkjG.o: In function `main':
exemplo.c:(.text+0x6e): undefined reference to `unif01_CreateExternGenBits'
exemplo.c:(.text+0x7e): undefined reference to `bbattery_SmallCrush'
exemplo.c:(.text+0x8a): undefined reference to `unif01_DeleteExternGenBits'
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'exemplo' failed
make: *** [exemplo] Error 1
%
Run Code Online (Sandbox Code Playgroud)

我期待命令cc exemplo.c -o exemplo -ltestu01.如何确保链接器的提示到命令行的末尾?

c makefile ld ldflags

2
推荐指数
1
解决办法
82
查看次数

标签 统计

c ×2

carriage-return ×1

ld ×1

ldflags ×1

makefile ×1

windows ×1