473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Class Declaration and Definition in Visual C++

Hi everyone,

I've programmed C++ on a nix platform for several years, and am now trying
to develop using Visual C++ on Windows. However, I'm encountering a problem
with my class identifiers, with the compiler telling me that there's a
syntax error in the identifier as follows:

error C2061: syntax error: identifier 'intPoint';

The definition is as follows:

class intPoint {
public:
int x, y;
}

This code works fine with gnu-c++, but VisC++ throws up the above error.

Has anyone got any clues to help me out? I tried the MSDN library, but none
of the work-arounds seemed suitable. Surely I must be able to declare a
class the way C++ intended?

Regards,

Rupert.
Jul 19 '05 #1
6 8833
Hello

You should put a semi-colon after the closing brace of 'class'

--
Elias
http://lgwm.org/
"Rupert Jones" <news@~nospam~i-ps.net> wrote in message
news:sk******************@wards.force9.net...
Hi everyone,

I've programmed C++ on a nix platform for several years, and am now trying
to develop using Visual C++ on Windows. However, I'm encountering a problem with my class identifiers, with the compiler telling me that there's a
syntax error in the identifier as follows:

error C2061: syntax error: identifier 'intPoint';

The definition is as follows:

class intPoint {
public:
int x, y;
}

This code works fine with gnu-c++, but VisC++ throws up the above error.

Has anyone got any clues to help me out? I tried the MSDN library, but none of the work-arounds seemed suitable. Surely I must be able to declare a
class the way C++ intended?

Regards,

Rupert.

Jul 19 '05 #2
Hi,

Actually, in my original code I have the semi-colon. I just forgot to copy
it across for this post.

"lallous" <la*****@lgwm.org> wrote in message
news:bl************@ID-161723.news.uni-berlin.de...
Hello

You should put a semi-colon after the closing brace of 'class'

--
Elias
http://lgwm.org/
"Rupert Jones" <news@~nospam~i-ps.net> wrote in message
news:sk******************@wards.force9.net...
Hi everyone,

I've programmed C++ on a nix platform for several years, and am now trying to develop using Visual C++ on Windows. However, I'm encountering a

problem
with my class identifiers, with the compiler telling me that there's a
syntax error in the identifier as follows:

error C2061: syntax error: identifier 'intPoint';

The definition is as follows:

class intPoint {
public:
int x, y;
}

This code works fine with gnu-c++, but VisC++ throws up the above error.

Has anyone got any clues to help me out? I tried the MSDN library, but

none
of the work-arounds seemed suitable. Surely I must be able to declare a
class the way C++ intended?

Regards,

Rupert.


Jul 19 '05 #3


"Rupert Jones" <news@~nospam~i-ps.net> wrote in message
news:sk******************@wards.force9.net...
Hi everyone,

I've programmed C++ on a nix platform for several years, and am now trying
to develop using Visual C++ on Windows. However, I'm encountering a problem with my class identifiers, with the compiler telling me that there's a
syntax error in the identifier as follows:

error C2061: syntax error: identifier 'intPoint';

The definition is as follows:

class intPoint {
public:
int x, y;
}

This code works fine with gnu-c++, but VisC++ throws up the above error.


With a trailing ';' it compiles fine on VC6.5 and VC7.1 for me. Is the file
extension .c rather than .cpp? Then the source will be compiled as C rather
than C++. Otherwise the problem may actually be due to something previous to
this line of code. You don't really provide sufficient context to give you
further help.

--

Jeff Flinn
Applied Dynamics, International
Jul 19 '05 #4

"Rupert Jones" <news@~nospam~i-ps.net> wrote in message
news:ne******************@wards.force9.net...
Hi,

Actually, in my original code I have the semi-colon. I just forgot to copy
it across for this post.


Bad habit.
Jul 19 '05 #5
lallous wrote:
Hello


Please don't top-post. Read section 5 of the FAQ for posting guidelines.

http://www.parashift.com/c++-faq-lite/

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #6
Rupert Jones wrote:
Hi,


Please don't top-post. Read section 5 of the FAQ for posting guidelines.

http://www.parashift.com/c++-faq-lite/

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DanielBradley | last post by:
Hello all, I have recently been porting code from Linux to cygwin and came across a problem with static const class members (discussed below). I am seeking to determine whether I am programming...
21
by: anddos | last post by:
i am just wondering what is the friend in a class , ive got a book about c++ but it dosent explain deep enough . anyone care to make a example with a few notes on what the friend can benifit from....
4
by: Jerome | last post by:
Hi all, I'm trying to use forward declaration with value class but I don't succeed in compiling my (quite simple) sample code. This is my code I'm trying to compile (Visual Studio 2003) ...
1
by: Miguel Isidoro | last post by:
I generated a .cs class from a .xsd schema using the xsd.exe tool from Visual Studio 2005 and noticed that is generating duplicate class declarations. This happens because of my schema structure. I...
17
by: Fabry | last post by:
Hi All, I'm new of this group and I do not know if this is the correct group for my question. I have a DLL with its export library (.lib) wrote in Borland C++ 6. In borland everything is OK and...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
4
by: zfareed | last post by:
#include <iostream> #include <fstream> using namespace std; template<class ItemType> class SortedList { private:
9
by: Jess | last post by:
Hello, I was told that if I declare a static class constant like this: class A{ static const int x = 10; }; then the above statement is a declaration rather than a definition. As I've...
15
by: akomiakov | last post by:
Is there a technical reason why one can't initialize a cost static non- integral data member in a class?
7
by: QiongZ | last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.