Solved

syntax error : 'constant'

Posted on 1998-08-12
10
1,054 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
Comment Utility
Edited text of question
0
 
LVL 10

Expert Comment

by:rbr
Comment Utility
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
Comment Utility
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
 

Author Comment

by:k1024
Comment Utility
---line455~463
///////////////////////
//CDrawRect

IMPLEMENT_SREIAL( CDrawRect, CDrawObj, 0) ;

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

Accepted Solution

by:
rbr earned 200 total points
Comment Utility
How is m_nCtrCount declared. If it is a constant you can't assign a value.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:k1024
Comment Utility
protected:
int m_nCtrCount;
0
 
LVL 23

Expert Comment

by:chensu
Comment Utility
>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
Comment Utility
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
Comment Utility
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
Comment Utility
Do you have DECLARE_SERIAL(CDrawRect) inside the class declaration in the header file?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now