1

When I add the string library (#include <string>) I get around 100 errors when compiling. Windows.h is already included so I don't know what the problem is.

Any help would be appreciated.

Errors are listed below.

Error   105 error C1003: error count exceeds 100; stopping compilation  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio   39  1   STablUpd
Error   99  error C2054: expected '(' to follow 'using' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio   36  1   STablUpd
Error   101 error C2054: expected '(' to follow 'using' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio   38  1   STablUpd
Error   5   error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    28  1   STablUpd
Error   8   error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    29  1   STablUpd
Error   12  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    30  1   STablUpd
Error   16  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    31  1   STablUpd
Error   20  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    32  1   STablUpd
Error   24  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    33  1   STablUpd
Error   28  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    34  1   STablUpd
Error   32  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    35  1   STablUpd
Error   35  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    37  1   STablUpd
Error   38  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    38  1   STablUpd
Error   42  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    39  1   STablUpd
Error   46  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    40  1   STablUpd
Error   50  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    41  1   STablUpd
Error   54  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    42  1   STablUpd
Error   58  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    43  1   STablUpd
Error   62  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    44  1   STablUpd
Error   65  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    46  1   STablUpd
Error   67  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    48  1   STablUpd
Error   70  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    49  1   STablUpd
Error   74  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    50  1   STablUpd
Error   78  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    51  1   STablUpd
Error   82  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    52  1   STablUpd
Error   86  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    53  1   STablUpd
Error   90  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    54  1   STablUpd
Error   94  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    55  1   STablUpd
Error   97  error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    57  1   STablUpd
Error   103 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio   39  1   STablUpd
Error   64  error C2061: syntax error : identifier 'abs'    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    46  1   STablUpd
Error   66  error C2061: syntax error : identifier 'acos'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    48  1   STablUpd
Error   4   error C2061: syntax error : identifier 'acosf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    28  1   STablUpd
Error   34  error C2061: syntax error : identifier 'acosl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    37  1   STablUpd
Error   68  error C2061: syntax error : identifier 'asin'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    48  1   STablUpd
Error   6   error C2061: syntax error : identifier 'asinf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    28  1   STablUpd
Error   36  error C2061: syntax error : identifier 'asinl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    37  1   STablUpd
Error   69  error C2061: syntax error : identifier 'atan'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    49  1   STablUpd
Error   71  error C2061: syntax error : identifier 'atan2'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    49  1   STablUpd
Error   9   error C2061: syntax error : identifier 'atan2f' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    29  1   STablUpd
Error   39  error C2061: syntax error : identifier 'atan2l' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    38  1   STablUpd
Error   7   error C2061: syntax error : identifier 'atanf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    29  1   STablUpd
Error   37  error C2061: syntax error : identifier 'atanl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    38  1   STablUpd
Error   72  error C2061: syntax error : identifier 'ceil'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    49  1   STablUpd
Error   10  error C2061: syntax error : identifier 'ceilf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    29  1   STablUpd
Error   40  error C2061: syntax error : identifier 'ceill'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    38  1   STablUpd
Error   102 error C2061: syntax error : identifier 'clearerr'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio   39  1   STablUpd
Error   73  error C2061: syntax error : identifier 'cos'    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    50  1   STablUpd
Error   11  error C2061: syntax error : identifier 'cosf'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    30  1   STablUpd
Error   75  error C2061: syntax error : identifier 'cosh'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    50  1   STablUpd
Error   13  error C2061: syntax error : identifier 'coshf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    30  1   STablUpd
Error   43  error C2061: syntax error : identifier 'coshl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    39  1   STablUpd
Error   41  error C2061: syntax error : identifier 'cosl'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    39  1   STablUpd
Error   76  error C2061: syntax error : identifier 'exp'    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    50  1   STablUpd
Error   14  error C2061: syntax error : identifier 'expf'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    30  1   STablUpd
Error   44  error C2061: syntax error : identifier 'expl'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    39  1   STablUpd
Error   77  error C2061: syntax error : identifier 'fabs'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    51  1   STablUpd
Error   15  error C2061: syntax error : identifier 'fabsf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    31  1   STablUpd
Error   45  error C2061: syntax error : identifier 'fabsl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    40  1   STablUpd
Error   104 error C2061: syntax error : identifier 'fclose' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio   39  1   STablUpd
Error   79  error C2061: syntax error : identifier 'floor'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    51  1   STablUpd
Error   17  error C2061: syntax error : identifier 'floorf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    31  1   STablUpd
Error   47  error C2061: syntax error : identifier 'floorl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    40  1   STablUpd
Error   80  error C2061: syntax error : identifier 'fmod'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    51  1   STablUpd
Error   18  error C2061: syntax error : identifier 'fmodf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    31  1   STablUpd
Error   48  error C2061: syntax error : identifier 'fmodl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    40  1   STablUpd
Error   81  error C2061: syntax error : identifier 'frexp'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    52  1   STablUpd
Error   19  error C2061: syntax error : identifier 'frexpf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    32  1   STablUpd
Error   49  error C2061: syntax error : identifier 'frexpl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    41  1   STablUpd
Error   96  error C2061: syntax error : identifier 'hypot'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    57  1   STablUpd
Error   98  error C2061: syntax error : identifier 'hypotf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    57  1   STablUpd
Error   83  error C2061: syntax error : identifier 'ldexp'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    52  1   STablUpd
Error   21  error C2061: syntax error : identifier 'ldexpf' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    32  1   STablUpd
Error   51  error C2061: syntax error : identifier 'ldexpl' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    41  1   STablUpd
Error   84  error C2061: syntax error : identifier 'log'    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    52  1   STablUpd
Error   85  error C2061: syntax error : identifier 'log10'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    53  1   STablUpd
Error   23  error C2061: syntax error : identifier 'log10f' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    33  1   STablUpd
Error   53  error C2061: syntax error : identifier 'log10l' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    42  1   STablUpd
Error   22  error C2061: syntax error : identifier 'logf'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    32  1   STablUpd
Error   52  error C2061: syntax error : identifier 'logl'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    41  1   STablUpd
Error   87  error C2061: syntax error : identifier 'modf'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    53  1   STablUpd
Error   25  error C2061: syntax error : identifier 'modff'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    33  1   STablUpd
Error   55  error C2061: syntax error : identifier 'modfl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    42  1   STablUpd
Error   88  error C2061: syntax error : identifier 'pow'    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    53  1   STablUpd
Error   26  error C2061: syntax error : identifier 'powf'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    33  1   STablUpd
Error   56  error C2061: syntax error : identifier 'powl'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    42  1   STablUpd
Error   89  error C2061: syntax error : identifier 'sin'    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    54  1   STablUpd
Error   27  error C2061: syntax error : identifier 'sinf'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    34  1   STablUpd
Error   91  error C2061: syntax error : identifier 'sinh'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    54  1   STablUpd
Error   29  error C2061: syntax error : identifier 'sinhf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    34  1   STablUpd
Error   59  error C2061: syntax error : identifier 'sinhl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    43  1   STablUpd
Error   57  error C2061: syntax error : identifier 'sinl'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    43  1   STablUpd
Error   92  error C2061: syntax error : identifier 'sqrt'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    54  1   STablUpd
Error   30  error C2061: syntax error : identifier 'sqrtf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    34  1   STablUpd
Error   60  error C2061: syntax error : identifier 'sqrtl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    43  1   STablUpd
Error   93  error C2061: syntax error : identifier 'tan'    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    55  1   STablUpd
Error   31  error C2061: syntax error : identifier 'tanf'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    35  1   STablUpd
Error   95  error C2061: syntax error : identifier 'tanh'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    55  1   STablUpd
Error   33  error C2061: syntax error : identifier 'tanhf'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    35  1   STablUpd
Error   63  error C2061: syntax error : identifier 'tanhl'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    44  1   STablUpd
Error   61  error C2061: syntax error : identifier 'tanl'   C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cmath    44  1   STablUpd
Error   100 error C2061: syntax error : identifier 'using'  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\cstdio   38  1   STablUpd
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
Ryan
  • 957
  • 5
  • 16
  • 34
  • 5
    Random guess - you are missing a closing brace somewhere on a namespace or class. – mindvirus Oct 31 '12 at 20:19
  • 1
    Is the file too long? Can you include some code? – imreal Oct 31 '12 at 20:21
  • do you get errors without the string header? – Caribou Oct 31 '12 at 20:23
  • maybe it's better to include or even although the slight difference with – TheNewOne Oct 31 '12 at 20:39
  • 1
    @TheNewOne - While `` and `` are related, they have no relation whatsoever to ``. The first pair named the C-style string functions. The latter name the C++ `std::string` object. – Robᵩ Oct 31 '12 at 20:40
  • 1
    Reduce your program by deleting everything that follows `#include `. Recompile. If you still have a problem, delete 1/2 of what precedes ``. Recompile. Keep deleting and recompiling until either 1) you've solved the problem, 2) you've got a one-line program, or 3) you're stuck. If you get to (3), come back and copy-paste that program here. See http://SSCCE.ORG for more info. – Robᵩ Oct 31 '12 at 20:42
  • @Robᵩ:I said there's a difference but maybe he doesn't need the C++ string abilities, also according to error it looks like he might forgot to use *using namespace std;* after the include. – TheNewOne Oct 31 '12 at 20:43
  • When not using the header, I don't get any errors. I only get errors when I include the header. – Ryan Oct 31 '12 at 20:51
  • @user1661022 - Yes, we understand that. What about when you delete the *other* lines in your program, but still include ``? Do you still get an error? – Robᵩ Oct 31 '12 at 21:04
  • Yes, I still get the error when I delete the other lines. – Ryan Oct 31 '12 at 21:31
  • See [includes or rises compile errors](http://stackoverflow.com/questions/12817591/includes-cstring-or-string-rises-compile-errors?rq=1) – Bo Persson Oct 31 '12 at 21:41
  • I'll proffer up the obvious. Are you compiling a .c file, or .cpp file? – WhozCraig Oct 31 '12 at 21:44
  • Just realised that it's C, not C++. (File extension is .c) – Ryan Nov 01 '12 at 11:29

1 Answers1

0

For anyone who is still looking for this:

"The solution to this was to make a right click on each C code and Properties>C/C++>Advanced>Compile As and check Compile as C++ Code(/TP)"

source: stack overflow :)