473,804 Members | 4,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using class from a different file as a global variable generates "missing storage" er

3 New Member
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).

[code]
// DataGraber.h

#ifndef DataGrabber
#define DataGrabber
#include "EDRTSV1.h"

class EDRTSFamStn{
//...Declirations

};

#endif

//DataGrabber.cpp
#include "DataGrabbe r.h"

////**** Class EDRTSFamStn Implementation ****////


// EDRTSV1.h
#include "DataGrabbe r.h"

///*** Gloabal Variables ***///

extern EDRTSFamStn* testing;

//EDRTSV1.cxx
#include "EDRTSV1.h"
EDRTSFamStn* testing;

[ /CODE]

Compiling...
EDRTSV1.cxx
DataGrabber.cpp
e:\stdt1\edrtsv 1\edrtsv1.h(59) : error C2143: syntax error : missing ';' before '*'
e:\stdt1\edrtsv 1\edrtsv1.h(59) : error C2501: 'testing' : missing storage-class or type specifiers

If I delete the testing variable both from the h and the cpp file, then it builds correctly.

Appreciate any help on that matter.
Thanks in advance,
Ran
Oct 29 '06 #1
1 1654
Banfa
9,065 Recognized Expert Moderator Expert
This is because in

// DataGraber.h

#ifndef DataGrabber
#define DataGrabber
#include "EDRTSV1.h"

class EDRTSFamStn{
//...Declirations

};

#endif

You have included the file EDRTSV1.h which tries to use the type EDRTSFamStn before it has been declared further down in the file.

You probably need to reorganise your files, if DataGrabber.h defines types and
EDRTSV1.h declares data then EDRTSV1.h should probably include DataGrabber.h, not the other way round.



I can see that EDRTSV1.h includes DataGrabber.h but if DataGrabber.h is the first thing included (as in DataGrabber.c) then by the time you get to include DataGrabber.h in EDRTSV1.h you have already entered the include protection in DataGrabber.h so nothing is included.

It is always a mistake to include A.h in B.h and include B.h in A.h
Oct 30 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2198
by: Kamlesh | last post by:
Hello, I am writing a computer graphics program in Turbo C compiler on DOS environment. The source code includes "vga.h", but I do not have this file in my TurboC directory. Please let me know from where can I get this file? If I cannot get this file for Turbo C, can I get it for Linux based C Compiler???
1
1621
by: Burkhard Perkens-Golomb | last post by:
Hi, I've a question about XML documentation of overridding methods and methods implementing an interface declaration: These methods are normally documented in the base class or interface. So I don't want to write new documentation when overriding or implementing. But if I leave out documentation and compile my assembly with "/doc" the compiler warns me about missing documentation. How can I tell the compiler that these methods don't...
10
2192
by: Alpha | last post by:
I use FolderBrowserDlg for user to select a folder path then store it in the sql table. I then retrieve it to concatenate in a sqlcommand text to retrive files from that directory but it won't work because the database has it as "\\Support\VMS\VMSDB" while the C# code expects to see @"\\Support\\VMS\\VMSDB" . Is there a way to fix this? Thanks, alpha
3
1943
by: Mark | last post by:
Hello, Recently I have not been able to open an asp.net page in MDE's web from designer. I recieve the following error: "The file failed to load in the web from designer. Please correct the following error, then load again: Not enough storage is available to complete this operation" I have 54Gigs of free space and a gig of ram. Rebooting has not helped. This is the GUI portion of a web project that is spilt into a DAL, BLL and
4
5101
by: Philip Nelson | last post by:
Folks, I've got a database and tablespaces "managed by automatic storage". I've deleted a lot of data from some tables. I've then reorged them. But the tablespaces don't appear to shrink in size (they just have lots of free space). How can I get DB2 to give the space back ?
1
5758
by: Tomas | last post by:
When I try to load my xslt i get an xml exception with the message "Root element is missing". The stylesheet works when I preview it in stylus studio, but apparently not in my application. Any ideas what may be wrong? The stylesheet: <?xml version="1.0" encoding="utf-8"?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output indent="yes"/>
1
4291
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_ ...
3
35073
by: lisa.bogart | last post by:
I am getting a "Root element is missing" error when I try to load a stream into and XmlDocument. Can anyone help me with what I am doing wrong??? Dim xmlTextWriter As XmlTextWriter = Nothing Dim objFile As FileStream = Nothing objStream = New MemoryStream()
11
3896
by: MC | last post by:
I have a couple of customers who are using a program that deserializes an XML file, and on some files, the program fails to see the content of the file -- treats it as zero length and reports "root element is missing" -- even though in Notepad the file looks normal. Has anybody ever seen this? Any clues? I have not been able to reproduce it on my computer. In general, when they e-mail me the files, the files arrive perfectly normal. ...
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10593
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...
1
10329
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
9163
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...
0
6858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
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...
1
4304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3000
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.