Solved

syntax error : 'constant'

Posted on 1998-08-12
10
1,060 Views
Last Modified: 2010-05-18
netiod?
I followed your answer...
IMPLEMENT_SREIAL( CDrawRect, CDrawObj, 0) ;
but, this error occor!!!
------

C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(458) : error C2059: syntax error : 'constant'

draw.exe - 1 error(s), 0 warning(s)
------
0
Comment
Question by:k1024
  • 4
  • 3
  • 2
  • +1
10 Comments
 

Author Comment

by:k1024
ID: 1170145
Edited text of question
0
 
LVL 10

Expert Comment

by:rbr
ID: 1170146
Can you pls post more code and mark the line 458. It's hard to see the error without code.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1170147
You may continue your another question with more comments since the problem has not yet been solved. It is difficult to find out the problem because there is no context. Delete this question to save your points.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:k1024
ID: 1170148
---line455~463
///////////////////////
//CDrawRect

IMPLEMENT_SREIAL( CDrawRect, CDrawObj, 0) ;

CDrawRect::CDrawRect()
{
      m_nCtrCount=8; //ÄÁÆ®·Ñ Æ÷ÀÎÆ®ÀÇ °¹¼ö
}
0
 
LVL 10

Accepted Solution

by:
rbr earned 200 total points
ID: 1170149
How is m_nCtrCount declared. If it is a constant you can't assign a value.
0
 

Author Comment

by:k1024
ID: 1170150
protected:
int m_nCtrCount;
0
 
LVL 23

Expert Comment

by:chensu
ID: 1170151
>How is m_nCtrCount declared. If it is a constant you can't assign a value.

If it was a constant, the error message would not have been "error C2059: syntax error : 'constant'".

Try removing the ';' at the end of the IMPLEMENT_SREIAL line to see what happens.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1170152
k1024,
     I was trying to save you 200 points.  That's, why I said to ask a 0 point question.
   If you try to send me the code, I'll see if I can compile it.  My e-mail address is nietod@theshop.net.

rbr,
   rbr, your answer is really a question, not an answer.  A question that cost k1024 200 points.

EXPERTS
The code appears in the original question asked by k1024.  You can look at it there.  But beware he posted the entire code 2 times.  At 28.8 it takes about 5 minutes to load and has a very bad impact on ones computer performance.  Apparently large web pages aren't a good idea.

0
 

Author Comment

by:k1024
ID: 1170153
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(458) : error C2059: syntax error : 'constant'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(460) : error C2321: syntax error : unexpected 'CDrawRect::CDrawRect::CDrawRectCDrawRect::CDrawRect'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(463) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(469) : error C2501: 'm_nCtrCount' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(470) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(476) : error C2065: 'ar' : undeclared identifier
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(476) : error C2501: 'Serialize' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(476) : error C2350: 'CDrawObj::Serialize' is not a static member
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(477) : error C2143: syntax error : missing ';' before 'if'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(481) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(485) : error C2501: 'ar' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(485) : error C2239: unexpected token '>>' following declaration of 'ar'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(485) : error C2059: syntax error : '>>'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(486) : error C2501: 'm_nShape' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(486) : error C2065: 'wTemp' : undeclared identifier
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(488) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(499) : error C2143: syntax error : missing ';' before 'if'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(501) : error C2143: syntax error : missing ';' before 'if'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(504) : error C2501: 'pOldBrush' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(504) : error C2371: 'pOldBrush' : redefinition; different basic types
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(504) : error C2065: 'pDC' : undeclared identifier
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(504) : error C2227: left of '->SelectObject' must point to class/struct/union
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(505) : error C2501: 'pOldPen' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(505) : error C2371: 'pOldPen' : redefinition; different basic types
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(505) : error C2227: left of '->SelectObject' must point to class/struct/union
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(506) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(510) : error C2501: 'logPen' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(510) : error C2239: unexpected token '.' following declaration of 'logPen'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(510) : error C2059: syntax error : '.'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(511) : error C2501: 'logPen' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(511) : error C2086: 'logPen' : redefinition
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(511) : error C2239: unexpected token '.' following declaration of 'logPen'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(511) : error C2059: syntax error : '.'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(512) : error C2501: 'logPen' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(512) : error C2086: 'logPen' : redefinition
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(512) : error C2239: unexpected token '.' following declaration of 'logPen'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(512) : error C2059: syntax error : '.'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(514) : error C2143: syntax error : missing ';' before 'if'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(515) : error C2501: 'pOldBrush' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(515) : error C2371: 'pOldBrush' : redefinition; different basic types
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(515) : error C2227: left of '->SelectStockObject' must point to class/struct/union
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(516) : error C2501: 'pOldPen' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(516) : error C2371: 'pOldPen' : redefinition; different basic types
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(516) : error C2227: left of '->SelectObject' must point to class/struct/union
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(518) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(521) : error C2143: syntax error : missing ';' before 'switch'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(525) : error C2143: syntax error : missing ';' before 'break'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(526) : error C2143: syntax error : missing ';' before 'case'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(528) : error C2143: syntax error : missing ';' before 'break'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(529) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(531) : error C2501: 'pDC' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(531) : error C2239: unexpected token '->' following declaration of 'pDC'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(531) : error C2059: syntax error : '->'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(532) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(539) : error C2065: 'm_rect' : undeclared identifier
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(540) : error C2501: 'pClone' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(540) : error C2371: 'pClone' : redefinition; different basic types
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(540) : error C2239: unexpected token '->' following declaration of 'pClone'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(540) : error C2059: syntax error : '->'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(541) : error C2501: 'pClone' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(541) : error C2371: 'pClone' : redefinition; different basic types
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(541) : error C2239: unexpected token '->' following declaration of 'pClone'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(541) : error C2059: syntax error : '->'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(542) : error C2501: 'pClone' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(542) : error C2371: 'pClone' : redefinition; different basic types
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(542) : error C2239: unexpected token '->' following declaration of 'pClone'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(542) : error C2059: syntax error : '->'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(543) : error C2501: 'pClone' : missing decl-specifiers
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(543) : error C2371: 'pClone' : redefinition; different basic types
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(543) : error C2239: unexpected token '->' following declaration of 'pClone'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(543) : error C2059: syntax error : '->'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(544) : error C2061: syntax error : identifier 'pClone'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(544) : error C2244: 'AfxAssertValidObject' : unable to resolve function overload
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(547) : error C2143: syntax error : missing ';' before 'if'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(549) : error C2143: syntax error : missing ';' before 'return'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(550) : error C2143: syntax error : missing ';' before '}'
C:\Program Files\DevStudio\MyProjects\draw\DrawObj.cpp(555) : fatal error C1903: unable to recover from previous error(s); stopping compilation
DrawTool.cpp
drawView.cpp
MainFrm.cpp
ToolBar.cpp
Generating Code...
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\DrawObj.sbr': No such file or directory
Error executing bscmake.exe.

draw.exe - 78 error(s), 0 warning(s)
-----
if removing ';' , then above error!!!!
0
 
LVL 23

Expert Comment

by:chensu
ID: 1170154
Do you have DECLARE_SERIAL(CDrawRect) inside the class declaration in the header file?
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
getting a fire fox page (view page source ) in c++ 6 42
FMX enumerated colours 2 101
How to split this in C++ 4 103
I could not build boost code, 10 89
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question