LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-24-2010, 01:10 AM   #1
vendtagain
Member
 
Registered: Sep 2009
Distribution: Slackware, Debian, Mac OS X, Zenwalk, Puppy, Gentoo
Posts: 199

Rep: Reputation: 32
c++ enum


Code:
enum Eitem =   {XCAM,YCAM,ZCAM,
		XCEN,YCEN,ZCEN,
		XROT,YROT,ZROT,
		XSHIFT,YSHIFT,ZSHIFT};
Eitem avind;

Eitem getwhat(std::string awhat);
with this code I'm getting

"use of enum 'Eitem' without previsous declaration"
and
"Eitem does not name a type"

whats wrong here?
doesn't make sense to me.
am I missing something?

Last edited by vendtagain; 01-24-2010 at 01:39 AM.
 
Old 01-24-2010, 01:46 AM   #2
carbonfiber
Member
 
Registered: Sep 2009
Location: Sparta
Posts: 237

Rep: Reputation: 46
Code:
enum Eitem = {XCAM,YCAM,ZCAM,XCEN,YCEN,ZCEN,XROT,YROT,ZROT,XSHIFT,YSHIFT,ZSHIFT};
Code:
enum Eitem {XCAM,YCAM,ZCAM,XCEN,YCEN,ZCEN,XROT,YROT,ZROT,XSHIFT,YSHIFT,ZSHIFT};
 
1 members found this post helpful.
Old 01-24-2010, 01:55 AM   #3
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
looks like you have an = to much in your code, trial this for declaration

enum Eitem
{
XCAM,YCAM,ZCAM,
XCEN,YCEN,ZCEN,
XROT,YROT,ZROT,
XSHIFT,YSHIFT,ZSHIFT
};
 
Old 01-24-2010, 01:56 AM   #4
vendtagain
Member
 
Registered: Sep 2009
Distribution: Slackware, Debian, Mac OS X, Zenwalk, Puppy, Gentoo
Posts: 199

Original Poster
Rep: Reputation: 32
ah ok, thank you, that makes sense
 
Old 01-24-2010, 02:26 AM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
What *doesn't* make sense is why C++ enum's are still so crappy - even now, in 2010! - compared to Pascal "enumerations" (25++ years ago).

I'll take Delphi over C++ any day. Or Objective-C. Or C# or Java. *ANYTHING* but C++...

Sigh ...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C enum variable turnmeout Programming 1 08-27-2008 12:32 PM
Questions about enum. What would be a good use of enum? RHLinuxGUY Programming 5 06-11-2006 01:13 PM
enum inheritance in C++? graemef Programming 2 01-27-2006 10:14 PM
C Enum exvor Programming 3 09-27-2005 02:51 PM
C, enum confusion cigarstub Programming 2 09-27-2005 09:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration