473,394 Members | 1,841 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,394 software developers and data experts.

struct ptr within the same struct

Compiling the following code (C++):

struct _Item
{
int var1;
.......

_Item *pPointer;
}

under VS6.0 I get no errors but under VS2003 I get error using undefined type.
What is the solution to correctly compile the program using VS2003.
PS VS'06 does the same thing. Please help.
Thanks

Uf
Feb 19 '06 #1
5 1830
Ufit wrote:
Compiling the following code (C++):

struct _Item
The identifier "_Item" is reserved for the implementation. Don't
use it.
{
int var1;
.......

_Item *pPointer;
}

under VS6.0 I get no errors but under VS2003 I get error using
undefined type. What is the solution to correctly compile the program
using VS2003.


I get the syntax error at the line with the dots. When I compile this
program:

struct Item {
int i;
Item* pPointer;
};

int main() {
Item item;
}

with VC++ v7.1 (2003), I get no errors. Read the FAQ 5.8.

V
--
Please remove capital As from my address when replying by mail
Feb 19 '06 #2

"Victor Bazarov" <v.********@comAcast.net> wrote in message

The identifier "_Item" is reserved for the implementation. Don't
use it.
{
int var1;
.......

_Item *pPointer;
}
---
with VC++ v7.1 (2003), I get no errors. Read the FAQ 5.8.

I actualy use _xItem - but doesn't matter what name is used - error comes up.
Where's that faq 5.8 ?

U
Feb 19 '06 #3
TB
Ufit skrev:

"Victor Bazarov" <v.********@comAcast.net> wrote in message

The identifier "_Item" is reserved for the implementation. Don't
use it.
{
int var1;
.......

_Item *pPointer;
}

---

with VC++ v7.1 (2003), I get no errors. Read the FAQ 5.8.

I actualy use _xItem - but doesn't matter what name is used - error
comes up.
Where's that faq 5.8 ?


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

--
TB @ SWEDEN
Feb 19 '06 #4
Ufit wrote:
I actualy use _xItem - but doesn't matter what name is used - error comes up.


The problem is the leading underscore, not the alphanumerics that
follow.

Luke

Feb 19 '06 #5
"Ufit" <ko**************@NOpoczta.fm> wrote in message
news:dt**********@news.onet.pl
Compiling the following code (C++):

struct _Item
{
int var1;
.......

_Item *pPointer;
}

under VS6.0 I get no errors but under VS2003 I get error using
undefined type. What is the solution to correctly compile the program
using VS2003. PS VS'06 does the same thing. Please help.
Thanks

Uf


My guess is that you are compiling this as C code, not C++ code. For it to
compile as C code, you need to use struct, i.e.,

struct Item
{
int var1;
struct Item *pPointer;
};
--
John Carson
Feb 20 '06 #6

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

Similar topics

15
by: Steven T. Hatton | last post by:
The following may strike many of you as just plain silly, but it represents the kind of delelima I find myself in when trying to make a design decision. This really is a toy project written for...
6
by: S.Tobias | last post by:
I'm trying to understand how structure type completion works. # A structure or union type of unknown # content (as described in 6.7.2.3) is an incomplete type. It # is ...
15
by: Ken Allen | last post by:
I have some code from C/C++ that I am attempting to port to C#. I have come across an interesting problem that is quite common in complex C/C++ code: the us of UNION in structure definitions to...
4
by: DaHool | last post by:
Hi there !!! I browsed around the Internet in search for a solution of a little difficult problem i have in VB.NET.... However, i cannot find a suitable anwser anywhere, so i thought i'll give...
45
by: Zytan | last post by:
This returns the following error: "Cannot modify the return value of 'System.Collections.Generic.List<MyStruct>.this' because it is not a variable" and I have no idea why! Do lists return copies...
18
by: lovecreatesbea... | last post by:
1. The following code snippet uses minus operation on two pointers to calculate the distance between struct members. This is illegal, right? 2. s1 and s2 are type of the same struct S. Can the...
5
by: emmanuel.rivoire | last post by:
Hello, I spent almost a week to be able to embed Python within my C++ game engine. I wrote a mini-tutorial of what I was able to do so far here :...
4
by: Sheldon | last post by:
Hi, I have a unique case where I need an array of structs that grows and within this array is another struct that grows in some cases. I'm having trouble allocating memory. Since I have never...
6
by: BIll Cunningham | last post by:
pg 128 of kandr2 speaks of a struct struct point{ int x; int y; }; I understand this but what is it saying about using intialize variables like such.
4
by: Lew Pitcher | last post by:
(having trouble getting my reply through - hopefully, third time is a charm) On November 11, 2008 19:53, in comp.lang.c, BIll Cunningham (nospam@nspam.invalid) wrote: Why an int? Because K&R...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.