473,657 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(newby) missing storage class or identifier error

Hi all:
I am getting a "missing storage class or idetifier" error and I do not
understand what it means, therefore and I cannot figure it out. I am just
starting a new project and I cannot get past this (may be very simple)
error. My code is as follows:

/////////////////////////array.h
#ifndef array_h
#define array_h

const int MAX = 10;

class array
{
public:
array();
~array();
run();
private:
string playerNames[MAX];
int curTurn;
int numPlayers;
int i;
};

#endif

/////////////////////////array.cpp
#include "array.h"
#include <iostream>
#include <string>

using namespace std;

array::array()
{
for (i = 0; i < MAX; i++)
{
playerNames[i] = " ";
}
curTurn = 0;
numPlayers = 0;
}

array::run()
{
for (i = 0; i < MAX; i++)
{
playerNames[i] = " ";
}
curTurn = 0;
numPlayers = 0;
}

/////////////////////////main.cpp
#include "array.h"
//#include <string>

int main()
{
array a;
a.run();

return 0;
}

/////////////////////////end of code

Thanks in advance.

Jul 19 '05 #1
2 2838
"Sonoman" <fc*****@REMOVE cse.fau.edu> wrote...
Hi all:
I am getting a "missing storage class or idetifier" error and I do not
understand what it means, therefore and I cannot figure it out. I am just
starting a new project and I cannot get past this (may be very simple)
error. My code is as follows:
What does your compiler documentation say about that error?
What line of code does the compiler complain about?

/////////////////////////array.h
#ifndef array_h
#define array_h

const int MAX = 10;

class array
{
public:
array();
~array();
run();
A function declaration needs a return value type. Did you
mean to write

void run();

?


private:
string playerNames[MAX];
'string' is most likely undefined here. Did you forget to
include the right header?
int curTurn;
int numPlayers;
int i;
};

#endif

/////////////////////////array.cpp
#include "array.h"
#include <iostream>
#include <string>

using namespace std;

array::array()
{
for (i = 0; i < MAX; i++)
{
playerNames[i] = " ";
}
curTurn = 0;
numPlayers = 0;
}

array::run()
Again, a function definition should begin with the return
value type. Did you mean to write

void array::run()

???
{
for (i = 0; i < MAX; i++)
{
playerNames[i] = " ";
}
curTurn = 0;
numPlayers = 0;
}

/////////////////////////main.cpp
#include "array.h"
//#include <string>

int main()
{
array a;
a.run();

return 0;
}

/////////////////////////end of code

Thanks in advance.


HTH

Victor
Jul 19 '05 #2
"Sonoman" <fc*****@REMOVE cse.fau.edu> wrote...
Fixed the "void" error, but the compiler still does not like the *****
marked line.
(a) Your code below does not have "the ***** marked line".
(b) Include <string> into that header and make sure you declare
'playerNames' as
std::string playerNames[MAX];



"Victor Bazarov" <v.********@att Abi.com> wrote in message
news:vg******** ****@corp.super news.com...
"Sonoman" <fc*****@REMOVE cse.fau.edu> wrote...
Hi all:
I am getting a "missing storage class or idetifier" error and I do not
understand what it means, therefore and I cannot figure it out. I am just starting a new project and I cannot get past this (may be very simple)
error. My code is as follows:


What does your compiler documentation say about that error?
What line of code does the compiler complain about?

/////////////////////////array.h
#ifndef array_h
#define array_h

const int MAX = 10;

class array
{
public:
array();
~array();
run();


A function declaration needs a return value type. Did you
mean to write

void run();

?


private:
string playerNames[MAX];


'string' is most likely undefined here. Did you forget to
include the right header?
int curTurn;
int numPlayers;
int i;
};

#endif

/////////////////////////array.cpp
#include "array.h"
#include <iostream>
#include <string>

using namespace std;

array::array()
{
for (i = 0; i < MAX; i++)
{
playerNames[i] = " ";
}
curTurn = 0;
numPlayers = 0;
}

array::run()


Again, a function definition should begin with the return
value type. Did you mean to write

void array::run()

???
{
for (i = 0; i < MAX; i++)
{
playerNames[i] = " ";
}
curTurn = 0;
numPlayers = 0;
}

/////////////////////////main.cpp
#include "array.h"
//#include <string>

int main()
{
array a;
a.run();

return 0;
}

/////////////////////////end of code

Thanks in advance.


HTH

Victor


Jul 19 '05 #3

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

Similar topics

3
8807
by: Tobias | last post by:
Hallo, I have a strange problem here: I a VC++6 project that compiles without any errors. If i now include a certain header file from my project into a header file of a certain dialog class i get several compiler errors (missing storage-class or type specifiers) in the mentioned header file and in a header file of another dialog header file in my project. I don't expect a solution from you but can anyone give me a hint how i can find the...
2
10918
by: kalpana.sinduria | last post by:
Hi all, how to remove the following complle error. When I compiling the code I get the following errors: Compiling... CDrtEachDefFeat.cpp d:\ include\common\cdrtintegfeat.h(39) : error C2143: syntax error : missing ';' before '*'
5
3852
by: aneesh | last post by:
Hi all, I have a program, this works fine but if we declare static below "int i" it shows different storage class specifier. what will be the reason. #include <stdlib.h> static int i ; int i; int main()
3
2717
by: Bas Wassink | last post by:
Hello there, I'm having trouble understanding a warning produced by 'splint', a code-checker. The warning produced is: keywords.c: (in function keyw_get_string) keywords.c:60:31: Released storage Keywords.Keyword reachable from global A global variable does not satisfy its annotations when control is transferred. (Use -globstate to inhibit warning) keywords.c:60:11: Storage Keywords.Keyword released
10
2927
by: Fred Nelson | last post by:
Hi: I have programmed in VB.NET for about a year and I'm in the process of learing C#. I'm really stuck on this question - and I know it's a "newby" question: In VB.NET I have several routines that upload and process images. I can't get past "square one" with images in C#: This statement:
1
1648
by: rnot | last post by:
I encounter the following error mesagess (Linker errors I think cause it compiles well) whenever I try to define my classes in a global scope. I have four files: DataGrabber.h, Datagrabber.cpp, EDRTSV1.h, EDRTSV1.cxx I am using VC++ 6 (Yep I know). // DataGraber.h #ifndef DataGrabber #define DataGrabber #include "EDRTSV1.h"
14
2117
by: Richard Harter | last post by:
Apologies for the length - this post is best viewed with fixed font and a line width >= 72. Below is the source code for a C header file that provides a suite of storage management macros. I am asking for comments on it. In particular: Are there any gotchas that I have overlooked? Are there any suggestions for improvements? Is there a generally available superior packages to do the same thing with the same general licensing? ...
1
4280
by: BobPaul | last post by:
I'm following code out of a howto book and this is really bugging me. This header file was created by VStudio 6.0 when I did a "Right Click: Add Member Function" CLine is a class I wrote (per the book's instructions) and Line.h in included in Day10Doc.cpp Here is the contents of Day10Doc.h #if !defined(AFX_DAY10DOC_H__16736853_CB29_49E7_A8ED_C912CAE666EC__INCLUDED_) #define AFX_DAY10DOC_H__16736853_CB29_49E7_A8ED_C912CAE666EC__INCLUDED_ ...
1
3755
by: Giacomo Catenazzi | last post by:
Hello, To learn the details of C, I've build the following example, could you check if it is correct and if it miss some important cases? Are there some useful (real cases) examples of: - "function prototype scope" for structures and unions? - "extern" for internal linkage ?
0
8310
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8826
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7330
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.