错误:在'*'标记之前预期'=',',',';','asm'或'__attribute__'

时间:2011-10-14 05:28:13

标签: c linux

我非常非常非常熟悉Unix,但是经验丰富。我不确定这条消息是否适合Unix论坛(如果有的话),或C.但是,因为它是一个编译错误,我觉得它最适合这里。

我对一个名为ioquake3的程序进行了“make”编译。我收到这些错误。我试着谷歌他们。似乎这些错误是由双重包含或类似的东西引起的。 我无休止地试着看看如何对代码进行编写。但是,我无法解决它。

提前谢谢。

代码:

#include <stdio.h>
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"

#ifdef WIN32
#define DEFAULT_CURL_LIB "libcurl-3.dll"
#elif defined(MACOS_X)
#define DEFAULT_CURL_LIB "libcurl.dylib"
#else
#define DEFAULT_CURL_LIB "libcurl.so.4"
#define ALTERNATE_CURL_LIB "libcurl.so.3"
#endif

#ifdef USE_LOCAL_HEADERS
  //#include &lt;../libcurl/curl/curl.h&gt;
#else
  //#include &lt;../libcurl/curl/curl.h&gt;
#endif


#ifdef USE_CURL_DLOPEN
extern char* (*qcurl_version)(void);
extern cvar_t *cl_cURLLib;
extern CURL* (*qcurl_easy_init)(void);
extern CURLcode (*qcurl_easy_setopt)(CURL *curl, CURLoption option, ...);
`enter code here`extern CURLcode (*qcurl_easy_perform)(CURL *curl);
extern void (*qcurl_easy_cleanup)(CURL *curl);
extern CURLcode (*qcurl_easy_getinfo)(CURL *curl, CURLINFO info, ...);
extern void (*qcurl_easy_reset)(CURL *curl);
extern const char *(*qcurl_easy_strerror)(CURLcode);

extern CURLM* (*qcurl_multi_init)(void);
extern CURLMcode (*qcurl_multi_add_handle)(CURLM *multi_handle,
                        CURL *curl_handle);
extern CURLMcode (*qcurl_multi_remove_handle)(CURLM *multi_handle,
                        CURL *curl_handle);
extern CURLMcode (*qcurl_multi_fdset)(CURLM *multi_handle,
                        fd_set *read_fd_set,
                        fd_set *write_fd_set,
                        fd_set *exc_fd_set,
                        int *max_fd);
extern CURLMcode (*qcurl_multi_perform)(CURLM *multi_handle,
                        int *running_handles);
extern CURLMcode (*qcurl_multi_cleanup)(CURLM *multi_handle);
extern CURLMsg *(*qcurl_multi_info_read)(CURLM *multi_handle,
                        int *msgs_in_queue);
extern const char *(*qcurl_multi_strerror)(CURLMcode);
#else
#define qcurl_version curl_version

#define qcurl_easy_init curl_easy_init
#define qcurl_easy_setopt curl_easy_setopt
#define qcurl_easy_perform curl_easy_perform
#define qcurl_easy_cleanup curl_easy_cleanup
#define qcurl_easy_getinfo curl_easy_getinfo
#define qcurl_easy_duphandle curl_easy_duphandle
#define qcurl_easy_reset curl_easy_reset
#define qcurl_easy_strerror curl_easy_strerror

#define qcurl_multi_init curl_multi_init
#define qcurl_multi_add_handle curl_multi_add_handle
#define qcurl_multi_remove_handle curl_multi_remove_handle
#define qcurl_multi_fdset curl_multi_fdset
#define qcurl_multi_perform curl_multi_perform
#define qcurl_multi_cleanup curl_multi_cleanup
#define qcurl_multi_info_read curl_multi_info_read
#define qcurl_multi_strerror curl_multi_strerror
#endif

qboolean CL_cURL_Init( void );
void CL_cURL_Shutdown( void );
void CL_cURL_BeginDownload( const char *localName, const char *remoteURL );
void CL_cURL_PerformDownload( void );
void CL_cURL_Cleanup( void );

错误:

make[2]: `build/release-linux-x86_64/ioq3ded.x86_64' is up to date.
CC code/client/cl_cgame.c
In file included from code/client/cl_cgame.c:24:
code/client/client.h:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
code/client/client.h:41: error: expected declaration specifiers or '...' before '*' token
code/client/client.h:41: error: expected ')' before '*' token
code/client/client.h:42: error: expected declaration specifiers or '...' before '*' token
code/client/client.h:42: error: expected ')' before '*' token
code/client/client.h:43: error: expected ')' before '*' token
code/client/client.h:44: error: expected declaration specifiers or '...' before '*' token
code/client/client.h:44: error: expected ')' before '*' token
code/client/client.h:45: error: expected ')' before '*' token
code/client/client.h:46: warning: parameter names (without types) in function declaration
code/client/client.h:48: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
code/client/client.h:49: error: expected declaration specifiers or '...' before '*' token
code/client/client.h:49: error: expected ')' before '*' token
code/client/client.h:51: error: expected declaration specifiers or '...' before '*' token
code/client/client.h:51: error: expected ')' before '*' token
code/client/client.h:53: error: expected declaration specifiers or '...' before '*' token
code/client/client.h:53: error: expected ')' before '*' token
code/client/client.h:58: error: expected declaration specifiers or '...' before '*' token
code/client/client.h:58: error: expected ')' before '*' token
code/client/client.h:60: error: expected declaration specifiers or '...' before '*' token
code/client/client.h:60: error: expected ')' before '*' token
code/client/client.h:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
code/client/client.h:63: warning: parameter names (without types) in function declaration
In file included from code/client/cl_cgame.c:24:
code/client/client.h:264: error: expected specifier-qualifier-list before 'CURL'
code/client/cl_cgame.c: In function 'CL_GetServerCommand':
code/client/cl_cgame.c:276: error: 'clientConnection_t' has no member named 'demoplaying'
code/client/cl_cgame.c: In function 'CL_InitCGame':
code/client/cl_cgame.c:751: error: 'clientConnection_t' has no member named 'demoplaying'
code/client/cl_cgame.c: In function 'CL_CGameRendering':
code/client/cl_cgame.c:799: error: 'clientConnection_t' has no member named 'demoplaying'
code/client/cl_cgame.c: In function 'CL_AdjustTimeDelta':
code/client/cl_cgame.c:834: error: 'clientConnection_t' has no member named 'demoplaying'
code/client/cl_cgame.c: In function 'CL_FirstSnapshot':
code/client/cl_cgame.c:900: error: 'clientConnection_t' has no member named 'timeDemoBaseTime'
code/client/cl_cgame.c:919: error: 'clientConnection_t' has no member named 'speexInitialized'
code/client/cl_cgame.c:921: error: 'clientConnection_t' has no member named 'speexEncoderBits'
code/client/cl_cgame.c:922: error: 'clientConnection_t' has no member named 'speexEncoderBits'
code/client/cl_cgame.c:924: error: 'clientConnection_t' has no member named 'speexEncoder'
code/client/cl_cgame.c:926: error: 'clientConnection_t' has no member named 'speexEncoder'
code/client/cl_cgame.c:927: error: 'clientConnection_t' has no member named 'speexFrameSize'
code/client/cl_cgame.c:928: error: 'clientConnection_t' has no member named 'speexEncoder'
code/client/cl_cgame.c:929: error: 'clientConnection_t' has no member named 'speexSampleRate'
code/client/cl_cgame.c:931: error: 'clientConnection_t' has no member named 'speexPreprocessor'
code/client/cl_cgame.c:931: error: 'clientConnection_t' has no member named 'speexFrameSize'
code/client/cl_cgame.c:932: error: 'clientConnection_t' has no member named 'speexSampleRate'
code/client/cl_cgame.c:935: error: 'clientConnection_t' has no member named 'speexPreprocessor'
code/client/cl_cgame.c:939: error: 'clientConnection_t' has no member named 'speexPreprocessor'
code/client/cl_cgame.c:943: error: 'clientConnection_t' has no member named 'speexDecoderBits'
code/client/cl_cgame.c:944: error: 'clientConnection_t' has no member named 'speexDecoderBits'
code/client/cl_cgame.c:945: error: 'clientConnection_t' has no member named 'speexDecoder'
code/client/cl_cgame.c:946: error: 'clientConnection_t' has no member named 'voipIgnore'
code/client/cl_cgame.c:947: error: 'clientConnection_t' has no member named 'voipGain'
code/client/cl_cgame.c:949: error: 'clientConnection_t' has no member named 'speexInitialized'
code/client/cl_cgame.c:950: error: 'clientConnection_t' has no member named 'voipMuteAll'
code/client/cl_cgame.c:953: error: 'clientConnection_t' has no member named 'voipTarget1'
code/client/cl_cgame.c:953: error: 'clientConnection_t' has no member named 'voipTarget2'
code/client/cl_cgame.c:953: error: 'clientConnection_t' has no member named 'voipTarget3'
code/client/cl_cgame.c: In function 'CL_SetCGameTime':
code/client/cl_cgame.c:969: error: 'clientConnection_t' has no member named 'demoplaying'
code/client/cl_cgame.c:972: error: 'clientConnection_t' has no member named 'firstDemoFrameSkipped'
code/client/cl_cgame.c:973: error: 'clientConnection_t' has no member named 'firstDemoFrameSkipped'
code/client/cl_cgame.c:1006: error: 'clientConnection_t' has no member named 'demoplaying'
code/client/cl_cgame.c:1045: error: 'clientConnection_t' has no member named 'demoplaying'
code/client/cl_cgame.c:1061: error: 'clientConnection_t' has no member named 'timeDemoStart'
code/client/cl_cgame.c:1062: error: 'clientConnection_t' has no member named 'timeDemoStart'
code/client/cl_cgame.c:1062: error: 'clientConnection_t' has no member named 'timeDemoLastFrame'
code/client/cl_cgame.c:1063: error: 'clientConnection_t' has no member named 'timeDemoMinDuration'
code/client/cl_cgame.c:1064: error: 'clientConnection_t' has no member named 'timeDemoMaxDuration'
code/client/cl_cgame.c:1067: error: 'clientConnection_t' has no member named 'timeDemoLastFrame'
code/client/cl_cgame.c:1068: error: 'clientConnection_t' has no member named 'timeDemoLastFrame'
code/client/cl_cgame.c:1071: error: 'clientConnection_t' has no member named 'timeDemoFrames'
code/client/cl_cgame.c:1073: error: 'clientConnection_t' has no member named 'timeDemoMaxDuration'
code/client/cl_cgame.c:1074: error: 'clientConnection_t' has no member named 'timeDemoMaxDuration'
code/client/cl_cgame.c:1076: error: 'clientConnection_t' has no member named 'timeDemoMinDuration'
code/client/cl_cgame.c:1077: error: 'clientConnection_t' has no member named 'timeDemoMinDuration'
code/client/cl_cgame.c:1083: error: 'clientConnection_t' has no member named 'timeDemoDurations'
code/client/cl_cgame.c:1083: error: 'clientConnection_t' has no member named 'timeDemoFrames'
code/client/cl_cgame.c:1087: error: 'clientConnection_t' has no member named 'timeDemoFrames'
code/client/cl_cgame.c:1088: error: 'clientConnection_t' has no member named 'timeDemoBaseTime'
code/client/cl_cgame.c:1088: error: 'clientConnection_t' has no member named 'timeDemoFrames'
make[2]: *** [build/release-linux-x86_64/client/cl_cgame.o] Error 1
make[2]: Leaving directory `/r/home7/yasir/minoru/cfe2/yasirTemp/ioquake3dev/best_linux_20111012/ioquake3dev_clean'
make[1]: *** [targets] Error 2
make[1]: Leaving directory `/r/home7/yasir/minoru/cfe2/yasirTemp/ioquake3dev/best_linux_20111012/ioquake3dev_clean'
make: *** [release] Error 2

语言C. Linux的

1 个答案:

答案 0 :(得分:6)

gcc中,错误:

code/client/client.h:40: error: expected '=', ',', ';', 'asm' or
    '__attribute__' before '*' token

几乎始终typedef相关联,当您使用它时,该pax> cat qq1.c ; gcc -o qq1 qq1.c mytype fn (int n) { return (mytype)n; } int main (void) { return 0; } qq1.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fn' pax> cat qq2.c ; gcc -o qq2 qq2.c typedef int mytype; mytype fn (int n) { return (mytype)n; } int main (void) { return 0; } qq2.c compiled okay. pax> _ 不在范围内。例如,请参阅以下脚本:

#ifdef USE_LOCAL_HEADERS
  //#include &lt;../libcurl/curl/curl.h&gt;
#else
  //#include &lt;../libcurl/curl/curl.h&gt;
#endif

现在有点难以辨别代码中的哪些实际行映射到错误中列出的行号,但我的第一个猜测是你没有包含CURL头文件。具体来说,我不确定你在这里想要做什么:

  #include <../libcurl/curl/curl.h>

看起来您已经从网页的“查看源”表示中复制了这些内容。您可能需要的是:

{{1}}

当然,调整头文件的实际位置。