Dec 11, 2012 at 9:26am Dec 11, 2012 at 9:26am UTC
Hi,
I've just picked up my first book in C++ and tried one of the beginning codes they sample in the book. I downloaded Visual Studios 2012 and created a new project, added new item, renamed to .c extension as it told me to do and began to write my first code. It gave me over 100 errors when I tried to debug and build and I'm not sure why.
//This program will give a list of my favorite foods
#include <iostream>
using namespace std;
int main()
{
cout << "My favorite foods are:\n";
cout << "BBQ Ribs";
cout << "\nChinese Food\n";
cout << "Lemon Drops\n";
return 0;
}
Warning 1 warning C4602: #pragma pop_macro : 'new' no previous #pragma push_macro for this identifier c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtgmath.h 111 1 ChapterTwo
Warning 2 warning C4193: #pragma warning(pop) : no matching '#pragma warning(push)' c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtgmath.h 112 1 ChapterTwo
Warning 3 warning C4161: #pragma pack(pop...) : more pops than pushes c:\program files (x86)\microsoft visual studio 11.0\vc\include\xtgmath.h 113 1 ChapterTwo
Error 4 error C2061: syntax error : identifier 'acosf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 28 1 ChapterTwo
Error 5 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 28 1 ChapterTwo
Error 6 error C2061: syntax error : identifier 'asinf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 28 1 ChapterTwo
Error 7 error C2061: syntax error : identifier 'atanf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 29 1 ChapterTwo
Error 8 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 29 1 ChapterTwo
Error 9 error C2061: syntax error : identifier 'atan2f' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 29 1 ChapterTwo
Error 10 error C2061: syntax error : identifier 'ceilf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 29 1 ChapterTwo
Error 11 error C2061: syntax error : identifier 'cosf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 30 1 ChapterTwo
Error 12 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 30 1 ChapterTwo
Error 13 error C2061: syntax error : identifier 'coshf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 30 1 ChapterTwo
Error 14 error C2061: syntax error : identifier 'expf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 30 1 ChapterTwo
Error 15 error C2061: syntax error : identifier 'fabsf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 31 1 ChapterTwo
Error 16 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 31 1 ChapterTwo
Error 17 error C2061: syntax error : identifier 'floorf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 31 1 ChapterTwo
Error 18 error C2061: syntax error : identifier 'fmodf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 31 1 ChapterTwo
Error 19 error C2061: syntax error : identifier 'frexpf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 32 1 ChapterTwo
Error 20 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 32 1 ChapterTwo
Error 21 error C2061: syntax error : identifier 'ldexpf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 32 1 ChapterTwo
Error 22 error C2061: syntax error : identifier 'logf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 32 1 ChapterTwo
Error 23 error C2061: syntax error : identifier 'log10f' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 33 1 ChapterTwo
Error 24 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 33 1 ChapterTwo
Error 25 error C2061: syntax error : identifier 'modff' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 33 1 ChapterTwo
Error 26 error C2061: syntax error : identifier 'powf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 33 1 ChapterTwo
Error 27 error C2061: syntax error : identifier 'sinf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 34 1 ChapterTwo
Error 28 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 34 1 ChapterTwo
Error 29 error C2061: syntax error : identifier 'sinhf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 34 1 ChapterTwo
Error 30 error C2061: syntax error : identifier 'sqrtf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 34 1 ChapterTwo
Error 31 error C2061: syntax error : identifier 'tanf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 35 1 ChapterTwo
Error 32 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 35 1 ChapterTwo
Error 33 error C2061: syntax error : identifier 'tanhf' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 35 1 ChapterTwo
Error 34 error C2061: syntax error : identifier 'acosl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 37 1 ChapterTwo
Error 35 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 37 1 ChapterTwo
Error 36 error C2061: syntax error : identifier 'asinl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 37 1 ChapterTwo
Error 37 error C2061: syntax error : identifier 'atanl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 38 1 ChapterTwo
Error 38 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 38 1 ChapterTwo
Error 39 error C2061: syntax error : identifier 'atan2l' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 38 1 ChapterTwo
Error 40 error C2061: syntax error : identifier 'ceill' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 38 1 ChapterTwo
Error 41 error C2061: syntax error : identifier 'cosl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 39 1 ChapterTwo
Error 42 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 39 1 ChapterTwo
Error 43 error C2061: syntax error : identifier 'coshl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 39 1 ChapterTwo
Error 44 error C2061: syntax error : identifier 'expl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 39 1 ChapterTwo
Error 45 error C2061: syntax error : identifier 'fabsl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 40 1 ChapterTwo
Error 46 error C2059: syntax error : ';' c:\program files
Error 50 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 41 1 ChapterTwo
Error 51 error C2061: syntax error : identifier 'ldexpl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 41 1 ChapterTwo
Error 52 error C2061: syntax error : identifier 'logl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 41 1 ChapterTwo
Error 53 error C2061: syntax error : identifier 'log10l' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 42 1 ChapterTwo
Error 54 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 42 1 ChapterTwo
Error 55 error C2061: syntax error : identifier 'modfl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 42 1 ChapterTwo
Error 56 error C2061: syntax error : identifier 'powl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 42 1 ChapterTwo
Error 57 error C2061: syntax error : identifier 'sinl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 43 1 ChapterTwo
Error 58 error C2059: syntax error : ';' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 43 1 ChapterTwo
Error 59 error C2061: syntax error : identifier 'sinhl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 43 1 ChapterTwo
Error 60 error C2061: syntax error : identifier 'sqrtl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 43 1 ChapterTwo
Error 61 error C2061: syntax error : identifier 'tanl' c:\program files (x86)\microsoft visual studio 11.0\vc\include\cmath 44 1 ChapterTwo
Dec 11, 2012 at 9:31am Dec 11, 2012 at 9:31am UTC
That program cannot generate those errors. Please post what you actually have.
Dec 11, 2012 at 3:11pm Dec 11, 2012 at 3:11pm UTC
I'm sure it's just the way you have vs configured... Those are some ridic errors
Dec 11, 2012 at 3:27pm Dec 11, 2012 at 3:27pm UTC
He probably needs to change the file extension back to .cpp instead of .c
(I have seen MSVC spit out those errors before - usually if you just create a project with all the default settings (precompiled headers, etc) and then change the file extension) - it confuses the system.
If the OP really wants the file extension of .c (and I can't think of a good reason why he would want the file extesnion of .c is this case ) - we may be able to fiddle with the project settings.
Last edited on Dec 11, 2012 at 3:36pm Dec 11, 2012 at 3:36pm UTC
Dec 12, 2012 at 8:02am Dec 12, 2012 at 8:02am UTC
@guestgulkan
Yes, this fixed the problem thank you.
@alistjazz
You were right also, thank you