C2143 Syntax Error Enum
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack
C2143 Syntax Error Missing ' ' Before 'using'
Overflow the company Business Learn more about hiring developers or posting ads with us Stack c2143 syntax error missing ' ' before 'type' Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community
Error C2143 Syntax Error Missing Before Class Head
of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Visual studio compiler errors at enum up vote 0 down vote favorite I have the following code error c2143 syntax error missing before string which compiles without errors under Linux and Mac OS X. I now want to compile the code with Windows, but I get a lot of errors in the following code segment: ... enum Type { UPDATE = 0, DELETE = 1 }; ... The error messages are these: 1>Request.hpp(48) : error C2143: syntax error : missing '}' before '(' 1>Request.hpp(48) : error C2059: syntax error : '
SQL Server 2014 Express resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel
Error C2143 Syntax Error Missing ' ' Before ' ' Template
9 Documentation APIs and reference Dev centers Retired content Samples We’re error c2143 syntax error missing ' ' before 'const' sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. Ask a question
Error C2059: Syntax Error : ''
Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: Problem with enum in visual C++ express 2010 Archived Forums V > http://stackoverflow.com/questions/8139738/visual-studio-compiler-errors-at-enum Visual C++ Express Edition Question 0 Sign in to vote Greetings everyone, I have this problem when trying to define an enumeration type in VC++ express edition 2010. The syntax highlighter gives the code a clean bill of health but when I build it I get this error: main.c(17): error C2143: syntax error : missing ';' before 'enum https://social.msdn.microsoft.com/Forums/en-US/11f2f493-5344-450e-a1d0-776b5c06a7e5/problem-with-enum-in-visual-c-express-2010?forum=Vsexpressvc [tag]'. Here's the code: srand(time(0)); enum Toss { HEAD, TAIL }; The statement write before it is delimited by a semicolon. And the code compiles cleanly using another compiler (gcc). So am scratching my head trying to figure out what's wrong. Is it a syntactic issue with enums in C vs. enums in C++ or is it a VC++ thing? jik Saturday, September 22, 2012 3:10 PM Answers 1 Sign in to vote Put the enum before srand(...). In the version of C implemented by Visual C++ (C89) declarations must come before statements. Note that this works fine in C++. Marked as answer by Damon ZhengMicrosoft contingent staff, Moderator Friday, September 28, 2012 9:48 AM Saturday, September 22, 2012 4:54 PM All replies 1 Sign in to vote Put the enum before srand(...). In the version of C implemented by Visual C++ (C89) declarations must come before statements. Note that this works fine in C++. Marked as answer by Damon ZhengMicrosoft contingent staff, Moderator Friday, September 2
Forum Visual C++ & C++ Programming C++ (Non Visual C++ Issues) enumeration giving weird error If this is your first visit, be sure to check out the FAQ by clicking the link http://forums.codeguru.com/showthread.php?437223-enumeration-giving-weird-error above. You may have to register or Login before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 8 of 8 Thread: enumeration giving weird error Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode October syntax error 24th, 2007,01:52 PM #1 utkseth View Profile View Forum Posts Member Join Date Sep 2007 Posts 34 enumeration giving weird error Hi I am facing a weird problem with my code. I am loading a .bmp file with a bmp loader but it gives me weird error. To make matters worse it works absolutely fine on other machine which have the same version of the Visual Studio I am using. I have c2143 syntax error attached the BMPLoader.cpp and BMPLoader.h files if you want to try, To be specific these are the lines where the error is coming. Code: enum CompressionType { BI_RGB, BI_RLE8, BI_RLE4 }; static CompressionType compression; The error is BMPLoader.cpp(41): error C2143: syntax error : missing '}' before 'constant' BMPLoader.cpp(44): error C2143: syntax error : missing ';' before '}' BMPLoader.cpp(44): error C2059: syntax error : '}' Please help Utk Attached Files BMPLoader.cpp (16.6 KB, 97 views) BMPLoader.h (2.7 KB, 86 views) Reply With Quote October 24th, 2007,06:58 PM #2 sockman View Profile View Forum Posts Member Join Date Aug 2006 Posts 157 Re: enumeration giving weird error Your compiler doesn't know what BI_RGB is. I am guessing that you are missing wingdi.h from your include path somewhere. Make sure you are including windows.h if you want to use these constants. BJW Reply With Quote October 24th, 2007,06:59 PM #3 ejac View Profile View Forum Posts Member Join Date Aug 2007 Posts 78 Re: enumeration giving weird error have you tried a clean and rebuild (if it seems to compile on the other sytem) Or comment out some stuff to make the error go away, and then gradually uncomment untill you find the exact source of the problem? Reply With Quote October 24th, 2007,07:12 PM #4 sockman