简体   繁体   English

错误:在“*”标记之前应有“=”、“、”、“;”、“asm”或“__attribute__”

[英]error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token

I am very very very new to Unix, but experienced in C. I wasn't sure whether this Message fits the Unix forum (if there's one), or C. But, since it is a compiling Error, I felt it fits here best.我对 Unix 非常非常陌生,但在 C 方面有经验。我不确定这个消息是否适合 Unix 论坛(如果有的话)或 C。但是,由于它是一个编译错误,我觉得它最适合这里.

I did a "make", compilation, to a program called ioquake3.我对一个名为 ioquake3 的程序进行了“make”编译。 I get these errors.我收到这些错误。 I tried to google them.我试着用谷歌搜索它们。 It seems that these errors are caused by double inclusions, or something of the sort.似乎这些错误是由双重包含或类似的东西引起的。 I tried endlessly to see how to make the write edits to the code.我无休止地尝试查看如何对代码进行写入编辑。 But, I couldn't fix it.但是,我无法修复它。

Thank you in advance.先感谢您。

Code:代码:

#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 );

Errors:错误:

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

Language C Linux语言 C Linux

In gcc , the error:gcc ,错误:

expected '=', ',', ';', 'asm' or '__attribute__' before '*' token

is often associated with an typedef that isn't in scope when you use it.通常与使用时不在范围内的typedef相关联。 For example, the following program:例如,以下程序:

mytype fn(int n) { return (mytype)n; }
int main(void) { return 0; }

generates this error when you try to compile it:当您尝试编译它时会生成此错误:

prog.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fn'

If you insert the line typedef int mytype;如果插入行typedef int mytype; at the top of the file, it compiles okay.在文件的顶部,它编译没问题。

Now it's a little hard to discern which precise lines in your code map to the line numbers listed in the errors, but my first guess would be that you do not include the CURL header files.现在有点难以辨别代码中哪些精确的行映射到错误中列出的行号,但我的第一个猜测是您没有包含 CURL 头文件。 This seems to be the case as you have lines like:这似乎是这种情况,因为您有以下几行:

extern CURL* (*qcurl_easy_init)(void);

but nowhere do you appear to include a header file that would give you a definition for the CURL type.但是您似乎没有任何地方包含一个头文件,它可以为您提供CURL类型的定义。

You do have the following code:确实有以下代码:

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

but this looks like you've copied these from a "view source" representation of a web page and just commented them out when they didn't work.但这看起来您已经从网页的“查看源代码”表示中复制了这些内容,并且在它们不起作用时将它们注释掉了。 What you probably need is something like:您可能需要的是:

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

adjusting, of course, for the actual location of the header file.当然,要根据头文件的实际位置进行调整。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:“ {”令牌|之前的预期&#39;=&#39;,&#39;,&#39;,&#39;;&#39;,&#39;asm&#39;或&#39;__attribute__&#39; - error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token| 错误:在&#39;:&#39;标记前应有&#39;=&#39;,&#39;,&#39;,&#39;;&#39;,&#39;asm&#39;或&#39;__attribute__&#39; - error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token 错误:在'{'令牌之前预期'=',',',';','asm'或'__attribute__' - error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token :1:错误:在&#39;{&#39;标记之前应为&#39;=&#39;,&#39;,&#39;,&#39;;&#39;,&#39;asm&#39;或&#39;__attribute__&#39; - :1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 错误:在 '.' 之前应有 '='、','、';'、'asm' 或 '__attribute__' 令牌 - error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 仍然是“错误:在&#39;*&#39;标记之前出现预期的&#39;=&#39;,&#39;,&#39;,&#39;;&#39;,&#39;asm&#39;或&#39;__attribute__&#39;” - Still the “error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token” 在&#39;&#39;之前预期&#39;=&#39;,&#39;,&#39;,&#39;;&#39;,&#39;asm&#39;或&#39;__attribute__&#39;。 代币 - expected '=', ',', ';', 'asm' or '__attribute__' before '.' token “在&#39;-&gt;&#39;标记之前的预期&#39;=&#39;,&#39;,&#39;,&#39;;&#39;,&#39;asm&#39;或&#39;__attribute__&#39; - "Expected '=', ',', ';', 'asm' or '__attribute__' before '->' token 在&#39;{&#39;令牌之前预期&#39;=&#39;,&#39;,&#39;,&#39;;&#39;,&#39;asm&#39;或&#39;__attribute__&#39; - expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 错误:预期在“ void”之前出现“ =”,“,”,“;”,“ asm”或“ __attribute__” - error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM