delorie.com/archives/browse.cgi | search |
Xref: | news2.mv.net comp.lang.c++:100341 comp.os.msdos.djgpp:7047 |
From: | gclind01 AT starbase DOT spd DOT louisville DOT edu (George C. Lindauer) |
Newsgroups: | comp.lang.c++,comp.os.msdos.djgpp |
Subject: | Re: struct problem. |
Date: | 10 Aug 1996 19:25:29 GMT |
Organization: | University of Louisville, Louisville KY USA |
Lines: | 23 |
Message-ID: | <4uinn9$h7p@hermes.louisville.edu> |
References: | <4ui949$9kn AT lion DOT cs DOT latrobe DOT edu DOT au> |
NNTP-Posting-Host: | starbase.spd.louisville.edu |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
cs3prj04 AT lion DOT cs DOT latrobe DOT edu DOT au (Cs3prj Group 04) writes: >I have a struct typedef defined called MenuBarItemS which contains no >constructors or destructors. >I want to use g++ but I do not want to use this struct as a class. >I want to create an array of these structs as follows : >Items=new MenuBarItemS[NumItems]; >The problem is that the compiler thinks that my struct is a class and is >creating a default copy constructor i.e. MenuBarItemS(MenuBarItemS &). >When the compiler hits the above statement it is trying to call its default >constructor for each array element but there are no arguments for it, hence >it generates the error message 'Too few arguments in call to constructor >. . .' Probably you included a class variable in your structure. You can't get around it without that class having a constructor that takes no args. David >How can I get around this problem?
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |