我正在处理这个非常简单的代码部分,但不知何故,构建错误对我来说很奇怪。我在项目中有这些文件:main.c
, http_request.h
, http_request.c
; 和一个简单的Makefile
.
1.http_request.h
/* STRUCTURES */
struct http_param {
char key[MAX_BUFFER];
char *value;
};
struct http_request {
int size;
struct http_param data[MAX_PARAM];
};
/* FUNCTIONS */
int parse_http_request(apr_pool_t *pool, const char *args, struct http_request *req); /* (A) */
2.http_request.c
#include <http_request.h>
...// something else goes here, it's fine
int
parse_http_request(apr_pool_t *pool, const char *args, struct http_request *req) /* (B) */
{
3. 生成文件
-I$(PROJECT_DIR)/include
此目录包含http_request.h
.
然后我构建,它引发了这个错误:
/project/src/http_request.c:14: warning: 'struct http_request' declared inside parameter list
/project/src/http_request.c:14: warning: its scope is only this definition or declaration, which is probably not what you want
/project/src/http_request.c: In function 'parse_http_request':
错误指向(A)
并且(B)
正如我在上面的源代码中提到的那样。
任何人都可以帮助找出问题所在吗?谢谢。