Сбой сборки из-за ошибок cstdio и cstdlib в Visual C

#c #visual-studio #visual-c

#c #visual-studio #visual-c

Вопрос:

Ошибки:

 1>------ Build started: Project: alglibTest, Configuration: Debug Win32 ------
1>Build started 5/22/2011 12:52:26 PM.
1>InitializeBuildStatus:
1>  Touching "DebugalglibTest.unsuccessfulbuild".
1>ClCompile:
1>  main.cpp
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(38): error C2054: expected '(' to follow 'using'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(40): error C2061: syntax error : identifier 'using'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(40): error C2054: expected '(' to follow 'using'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(40): error C2061: syntax error : identifier 'using'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(41): error C2061: syntax error : identifier 'clearerr'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(41): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(41): error C2061: syntax error : identifier 'fclose'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(41): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(41): error C2061: syntax error : identifier 'feof'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(41): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(42): error C2061: syntax error : identifier 'ferror'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(42): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(42): error C2061: syntax error : identifier 'fflush'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(42): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(42): error C2061: syntax error : identifier 'fgetc'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(42): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(43): error C2061: syntax error : identifier 'fgetpos'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(43): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(43): error C2061: syntax error : identifier 'fgets'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(43): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(43): error C2061: syntax error : identifier 'fopen'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(43): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(44): error C2061: syntax error : identifier 'fprintf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(44): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(44): error C2061: syntax error : identifier 'fputc'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(44): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(44): error C2061: syntax error : identifier 'fputs'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(44): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(45): error C2061: syntax error : identifier 'fread'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(45): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(45): error C2061: syntax error : identifier 'freopen'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(45): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(45): error C2061: syntax error : identifier 'fscanf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(45): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(46): error C2061: syntax error : identifier 'fseek'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(46): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(46): error C2061: syntax error : identifier 'fsetpos'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(46): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(46): error C2061: syntax error : identifier 'ftell'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(46): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(47): error C2061: syntax error : identifier 'fwrite'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(47): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(47): error C2061: syntax error : identifier 'getc'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(47): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(47): error C2061: syntax error : identifier 'getchar'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(47): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(48): error C2061: syntax error : identifier 'gets'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(48): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(48): error C2061: syntax error : identifier 'perror'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(48): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(49): error C2061: syntax error : identifier 'putc'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(49): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(49): error C2061: syntax error : identifier 'putchar'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(49): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(50): error C2061: syntax error : identifier 'printf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(50): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(50): error C2061: syntax error : identifier 'puts'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(50): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(50): error C2061: syntax error : identifier 'remove'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(50): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(51): error C2061: syntax error : identifier 'rename'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(51): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(51): error C2061: syntax error : identifier 'rewind'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(51): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(51): error C2061: syntax error : identifier 'scanf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(51): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(52): error C2061: syntax error : identifier 'setbuf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(52): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(52): error C2061: syntax error : identifier 'setvbuf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(52): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(52): error C2061: syntax error : identifier 'sprintf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(52): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(53): error C2061: syntax error : identifier 'sscanf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(53): error C2059: syntax error : ';'
1    >c:program filesmicrosoft visual studio 10.0vcincludecstdio(53): error C2061: syntax error : identifier 'tmpfile'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(53): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(53): error C2061: syntax error : identifier 'tmpnam'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(53): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(54): error C2061: syntax error : identifier 'ungetc'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(54): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(54): error C2061: syntax error : identifier 'vfprintf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(54): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(54): error C2061: syntax error : identifier 'vprintf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(54): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(55): error C2061: syntax error : identifier 'vsprintf'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdio(55): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(19): error C2054: expected '(' to follow 'using'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(19): error C2061: syntax error : identifier 'using'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(19): error C2054: expected '(' to follow 'using'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(21): error C2061: syntax error : identifier 'using'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(21): error C2061: syntax error : identifier 'abs'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(21): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(21): error C2061: syntax error : identifier 'atexit'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(21): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(22): error C2061: syntax error : identifier 'atof'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(22): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(22): error C2061: syntax error : identifier 'atoi'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(22): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(22): error C2061: syntax error : identifier 'atol'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(22): error C2059: syntax error : ';'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(23): error C2061: syntax error : identifier 'bsearch'
1>c:program filesmicrosoft visual studio 10.0vcincludecstdlib(23): fatal error C1003: error count exceeds 100; stopping compilation
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.57
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  

Что я могу с этим поделать?

Ответ №1:

Обычно это происходит, когда вы пытаетесь скомпилировать код C с заголовками C . Если вы хотите скомпилировать код C, измените заголовки C на заголовки C (cstdio на stdio.h, cstdlib на stdlib.h), если вы хотите скомпилировать код C , измените настройки вашего проекта (Свойства конфигурации -> C / C -> Дополнительно -> Компилировать как код C ).

Комментарии:

1. Заголовки, включенные в параметр компилятора / FI, также могут вызывать эту ошибку, если заголовок C обрабатывается как заголовок C.

2. Боже милостивый.. большое вам спасибо. Я программирую более десяти лет и только что впервые увидел это и был крайне смущен. Я честно думал, что Visual Studio была сломана, ха-ха. Я чувствую, что они могли бы гораздо лучше обнаружить это и предупредить вас о вашей опечатке. Я включил <string> вместо <string.h> .. упс.