这个.h是否正确?

时间:2016-05-26 22:17:58

标签: c

我有这个错误很奇怪:

Could not resolve URL for hyperlinked relationship using view name "contenttype-detail". You may have failed to include the related model in your API, or incorrectly configured the `lookup_field` attribute on this field.

main.c:

/tmp/ccq0e479.o:main.c:(.text+0x1a): undefined reference to
`ft_putchar' collect2: error: ld returned 1 exit status

ft_putchar.c:

#include "biblio.h"

int main(int argc, char** argv){

        ft_putchar(argv[1]);
        return 0;

}

biblio.h

#include <stdio.h>
#include "biblio.h"

    void ft_putchar (char* str){
            int i = 0;
            while (str[i] != '\0'){
                    write(1,str[i], 1);
                    i++;
            }
            write(1,'\0', 1);

    }

1 个答案:

答案 0 :(得分:7)

仅编译main.c是不够的,您需要编译这两个文件:

gcc main.c ft_putchar.c -o myprog

gcc -c main.c
gcc -c ft_putchar.c
gcc main.o ft_putchar.o -o myprog 

更多信息:Gcc tutorial