error expected identifier or before token

Краткий обзор программы (3 проблемы с телом):

Я думаю, что это может быть из-за неправильного вызова или создания внешней функции.

Ваша функция нуждается в имени! Блок кода вне любой функции в C не имеет смысла.

В вашем примере есть несколько синтаксических/концептуальных ошибок. Пожалуйста, очистите его и уточните свой вопрос — я постараюсь лучше ответить, когда вы это сделаете.

Теперь давайте рассмотрим следующий пример.

Если вы скомпилируете вышеуказанную программу, она даст вам следующую ошибку:

using namespace std;

int __attribute__((stdcall)) func (int _a, int _b);
extern __attribute__((cdecl)) int mul (int _a, int _b);

int main()
<
printf(«C start!
«);
int res = func(3, 4);
printf(«res = [%d]
«, res);
printf(«C end!
«);
>
extern __attribute__((cdecl)) int mul (int _a, int _b);
<
return _a*_b;
>

I initially had it like that with int main(void) < but then I was getting all these errors instead so I changed it to the semicolon and only got that one error.
a3.c: In function ‘main’: a3.c:24:5: error: expected declaration specifiers or ‘. ’ before ‘score’ a3.c:25:5: error: expected declaration specifiers or ‘. ’ before ‘srand’ a3.c:27:5: error: expected declaration specifiers or ‘. ’ before ‘printf’ a3.c:28:5: error: expected declaration specifiers or ‘. ’ before ‘printf’ a3.c:29:5: error: expected declaration specifiers or ‘. ’ before ‘scanf’ a3.c:31:5: error: expected declaration specifiers or ‘. ’ before ‘if’ a3.c:82:1: error: expected declaration specifiers or ‘. ’ before ‘>’ token a3.c:82:1: error: expected ‘;’, ‘,’ or ‘)’ before ‘>’ token a3.c:82:1: error: expected declaration or statement at end of input a3.c:82:1: warning: control reaches end of non-void function [-Wreturn-type]

closed as off-topic by Thomas Padron-McCarthy, Lorenzo Donati supports Monica, doitlikejustin, Eric Brown, Hong Ooi Oct 19 ’13 at 8:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

    «Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they d >If this question can be reworded to fit the rules in the help center, please edit the question.
Оцените статью