错误:输入末尾应为“}”
error: expected ‘}’ at end of input
我有以下代码:
#include <libubuntuone-1.0/u1-music-store.h>
#include <libsyncdaemon-1.0/libsyncdaemon/syncdaemon-authentication.h>
#include <libsyncdaemon-1.0/libsyncdaemon/syncdaemon-credentials.h>
#include <libsyncdaemon-1.0/libsyncdaemon/syncdaemon-daemon.h>
static void
get_credentials (U1MusicStore *music_store,
gchar **oauth_consumer_token,
gchar **oauth_consumer_secret,
gchar **oauth_token,
gchar **oauth_token_secret)
{
SyncdaemonCredentials *credentials;
*oauth_consumer_token = *oauth_consumer_secret = *oauth_token = *oauth_token_secret = NULL;
*oauth_consumer_token = g_strdup (syncdaemon_credentials_get_consumer_key (credentials));
*oauth_consumer_secret = g_strdup (syncdaemon_credentials_get_consumer_secret (credentials));
*oauth_token = g_strdup (syncdaemon_credentials_get_token (credentials));
*oauth_consumer_secret = g_strdup (syncdaemon_credentials_get_token_secret (credentials));
}
int main()
{
return 0;
}
唯一阻止它编译的是这个问题的标题中指定的错误消息。问题行已被确定为main
函数的右大括号,但显然不是这样,而且我看不出还有什么地方可以漏掉括号。其他人能发现我在这里做错了什么吗?
如果出现此类错误,最好将错误本地化。您可以简单地通过注释代码块来实现这一点。
在本例中,您可以对主体get_credentials
函数进行注释,并检查会发生什么。
在源代码文件的末尾粘贴空行也是个好主意。
可能包含的某些标头具有不匹配的大括号。
也许编译器不擅长处理最后一行不为空的文件,并且在某些文件中存在这样的行。
试着尽可能多地注释(尤其是所有包含)以使其编译,然后将代码放回原处,直到您将问题本地化。
相关文章:
- 堆栈中大小变量输入错误 (C++)
- 如果用户没有输入任何内容或输入错误,如何重新输入用户的输入?
- 如何从标准输入中检测格式化输入错误?
- 如何在没有打印语句的情况下报告用户输入错误
- 用户输入错误
- 按下Enter时如何输入错误消息,但没有给出任何答案
- 在我的IF-ELSE循环中输入错误
- C++ 输入错误
- C++ 函数输入错误
- 使用ifstreamwhile循环,如何显示输入错误并在下一行继续
- switch 语句中的输入错误 如何循环回第一种情况?C++
- 在 switch 语句中输入字符以进行C++时用户输入错误
- 如果我输入错误的 dos 命令,shellexecute 会给出正确的结果
- C++输入错误的数组
- scanf和多个输入错误
- C++输入浮点而不是整数时的输入错误
- 使用字符串流和if-else语句时发生字符串输入错误
- 当用户输入错误输入时,一次清除 cin 中的整行而不是一个字符
- setw() 在包含 UTF-8 多字节字符/码位的字符串上输入错误的输出
- c++中的getline输入错误