2017-04-16 46 views
0

https://stackoverflow.com/questions/43423803/document-classification-tool-in-c-compilation-error/43432470#43432470文档分类工具 - 在嵌套函数/范围编译错误(可以是)

在上述链路 我加入-fnested_functions作为

GCC -c ./rainbow后得到3个错误。 ç-fnested函数process_wv.c test_file.c test_hdb_file.c

(3档process_wv,test_file里面,test_hdb_file从rainbow.c移除和现在加入作为单独的.c文件的目录)

输出: -

./bow/libbow.h:1345:8: note: forward declaration of 'struct argp_child' 
struct argp_child;    /* forward declare this type */ 
    ^
./rainbow.c:655:5: error: function definition is not allowed here 
    { 
    ^
./rainbow.c:663:8: warning: extra tokens at end of #endif directive [-Wextra-tokens] 
#endif VPC_ONLY 
    ^
     // 
./rainbow.c:734:3: warning: implicit declaration of function 'do_indexing' is invalid in C99 
     [-Wimplicit-function-declaration] 
    do_indexing(); 
^
./rainbow.c:1175:49: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between 
     pointers to integer types with different sign [-Wpointer-sign] 
    newsockfd = accept(rainbow_sockfd, &cli_addr, &clilen); 
               ^~~~~~~ 
/usr/include/sys/socket.h:681:69: note: passing argument to parameter here 
int  accept(int, struct sockaddr * __restrict, socklen_t * __restrict) 
                     ^
./rainbow.c:1586:30: error: use of undeclared identifier 'test_file' 
     bow_map_filenames_from_dir (test_file.c, 0, dir, ""); 


          ^

PS为什么test_file.c不明(在docnames.c bow_map_filenames_from_dir)在rainbow.c即使它们是相同的弓20020213文件夹内(权限是755所有)

问候

回答

0

采取这一..作为一个起点:

./bow/libbow.h:1345:8: note: forward declaration of 'struct argp_child' 
struct argp_child;    /* forward declare this type */ 

链接的代码中有没有包括所有的头文件(在任何特定的头文件)的主要问题该特定的头文件需要。

顺便说一下:'struct argp_child'是在./argp/argp.h头文件中定义的。

我做了以下内容:

通过的.zip设施

扩大了我的Ubuntu Linux操作系统的计算机

cd ~/src_bow 
./configure 

编辑导致的.zip文件到〜/ src_bow下载的所有文件'Makefile'来定义宏:

CFLAGS = -g -O -Wall -Wextra -std=gnu11 -Wimplicit 

然后输入:

make -f Makefile 

结果是几百个警告,注意和错误

大多数编译器输出消息都是关于语法,完整的结构定义,忽略修饰符和转换然而,有许多暴露许多其他问题。

修复了几百个问题后,我停了下来。

要回答你的问题,你遇到的问题的根源与相应的头文件没有包含在其他头文件中,而这些头文件不包含在每个头文件中的头文件中。