Solved

syntax error : 'constant'

Posted on 1998-08-12
10
1,067 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Move constructor only called if marked noexcept? 6 123
passing data from one form to another form in c++ 27 102
C++ mouse_event mouse look 7 131
VS2015 Redefinition errors 4 103
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…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

734 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