Hi all gurus!
a little help here... -
/* Common.h file */
-
/*
-
** Media major and minor types
-
*/
-
typedef enum
-
{
-
VBMTYPE_UNKNOWN = 0,
-
VBMTYPE_AUDIO = 1,
-
VBMTYPE_VIDEO = 2
-
}
-
VBMTYPE;
-
-
/* console cpp file */
-
int main(array<System::String ^> ^args)
-
{
-
VBMTYPE _type = VBMTYPE::VBMTYPE_UNKNOWN;
-
-
if(_type==VBMTYPE::VBMTYPE_UNKNOWN)
-
{
-
_type = VBMTYPE::VBMTYPE_VIDEO;
-
}
-
-
-
Console::ReadLine();
-
return 0;
-
}
-
but the problem is _type value is always <undefined value>.
How can i set the value then?
Im using C++/CLI anyway.
regards,
gudguy
7 20581
An enum is not a class and VBMTYPE is not a namespace, use
VBMTYPE _type = VBMTYPE_UNKNOWN;
An enum is not a class and VBMTYPE is not a namespace, use
VBMTYPE _type = VBMTYPE_UNKNOWN;
Thanks arnaudk.
I tried your suggestion but still it gives me <undefined value>. For C++/CLI "enum class" i can assign a value, but for a "typedef enum" in native C++ it doesn't work.
Thanks arnaudk.
I tried your suggestion but still it gives me <undefined value>. For C++/CLI "enum class" i can assign a value, but for a "typedef enum" in native C++ it doesn't work.
Hi ,
i changed it like this and it is compiling OK without issues using g++ -
/* Common.h file */
-
/*
-
** Media major and minor types
-
*/
-
typedef enum
-
{
-
VBMTYPE_UNKNOWN = 0,
-
VBMTYPE_AUDIO = 1,
-
VBMTYPE_VIDEO = 2
-
}VBMTYPE;
-
-
/* console cpp file */
-
int main()
-
{
-
VBMTYPE _type = VBMTYPE_UNKNOWN;
-
if(_type==VBMTYPE_UNKNOWN)
-
{
-
_type = VBMTYPE_VIDEO;
-
}
-
-
-
return 0;
-
}
-
Thanks
Raghuram
Hi ,
i changed it like this and it is compiling OK without issues using g++ -
/* Common.h file */
-
/*
-
** Media major and minor types
-
*/
-
typedef enum
-
{
-
VBMTYPE_UNKNOWN = 0,
-
VBMTYPE_AUDIO = 1,
-
VBMTYPE_VIDEO = 2
-
}VBMTYPE;
-
-
/* console cpp file */
-
int main()
-
{
-
VBMTYPE _type = VBMTYPE_UNKNOWN;
-
if(_type==VBMTYPE_UNKNOWN)
-
{
-
_type = VBMTYPE_VIDEO;
-
}
-
-
-
return 0;
-
}
-
Thanks
Raghuram
Hi Raghuram,
The code I posted is compiling just fine as well. My problem is when I step through the code the line "VBMTYPE _type = VBMTYPE_UNKNOWN;" gives <undefined value> for _type. Even the line " _type = VBMTYPE_VIDEO;" or other values (member of VBMTYPE) gives <undefined value>. Not sure if this is native C++ behavior (can do assign externally but internally it has no meaning).
Regards,
Norman
Hi Raghuram,
The code I posted is compiling just fine as well. My problem is when I step through the code the line "VBMTYPE _type = VBMTYPE_UNKNOWN;" gives <undefined value> for _type. Even the line " _type = VBMTYPE_VIDEO;" or other values (member of VBMTYPE) gives <undefined value>. Not sure if this is native C++ behavior (can do assign externally but internally it has no meaning).
Regards,
Norman
Hi,
I tried debugging the code which i posted and it showed this
16 {
(gdb) n
17 VBMTYPE _type = VBMTYPE_UNKNOWN;
(gdb) n
18 if(_type==VBMTYPE_UNKNOWN)
(gdb) p _type ///Trying to print here.
$1 = VBMTYPE_UNKNOWN
(gdb) where
#0 main () at a.cpp:18
(gdb) x _type
0x0: Cannot access memory at address 0x0
II think you cant access the value of a enum in debugger.
Thanks
Raghuram
Hi,
I tried debugging the code which i posted and it showed this
16 {
(gdb) n
17 VBMTYPE _type = VBMTYPE_UNKNOWN;
(gdb) n
18 if(_type==VBMTYPE_UNKNOWN)
(gdb) p _type ///Trying to print here.
$1 = VBMTYPE_UNKNOWN
(gdb) where
#0 main () at a.cpp:18
(gdb) x _type
0x0: Cannot access memory at address 0x0
II think you cant access the value of a enum in debugger.
Thanks
Raghuram
Hi Raghuram,
Thanks for the investigation. So its only happening for a native "typedef enum"? Because for "enum class" in C++/CLI it is fine.
Regards,
gudguy
You can add a watch for the variable and edit the variable name like this:
Watch Window:
myVariable <undefined value> MY_ENUM
cast the variable in the watch window to see a value:
Watch Window:
(int)myVariable 5 int
the MSDN forums yielded this suggestion: http://forums.microsoft.com/MSDN/Sho...78305&SiteID=1 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Fao |
last post by:
Hi, I am in my first year of C++ in college and my professor wants me
to Write a Program with multiple functions,to input two sets of
user-defined data types:
One type named 'Sign' declared by...
|
by: Chris |
last post by:
I've lurked around long enough... Time to interract =)
I'm trying to make sense of the following. I can't quite wrap my head
around what this is actually doing:
-------------
typedef enum {...
|
by: stephen henry |
last post by:
Hi all,
I have a question that I'm having difficulty answering. If I have a
struct:
typedef struct my_struct_tag{
struct my_other_struct *other;
} my_struct_tag
|
by: Martin |
last post by:
This post asks two questions, which I've illustrated in one C source file
(see below), which clean compiles on my GNU compiler.
1. In K&R2, Section A8.9 it says "Declarations whose storage class...
|
by: Harris |
last post by:
Dear all,
I have the following codes:
======
public enum Enum_Value
{
Value0 = 0,
Value1 = 10,
|
by: =?utf-8?b?QXNiasO4cm4gU8OmYsO4?= |
last post by:
I came over this code which puzzled me. Isn't the enum supposed to
have an identifier?
enum {
BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
BT_OPEN,
BT_BOUND,...
|
by: msukumarbabu |
last post by:
Hi all,
What will be difference between "typedef enum" and "enum".
or
difference between “typedef structure" and "structure"
I am going through some code.
in that some place they are using...
|
by: wongjoekmeu |
last post by:
Hello all,
I was wondering what the differences are between these two things:
1) enum color { RED, BLUE };
and
2) typedef enum { RED, BLUE } color;
Is there a difference anyway ? Why...
|
by: C_guy |
last post by:
I noticed that
typedef enum _myEnum
{
enum1 = 0,
enum2,
enum3,
.....
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |