|
-
Aug 13th, 2003, 12:05 PM
#1
Thread Starter
Frenzied Member
Linking
Ok this is about to drive me nutz.
I have 4 .cpp file and 5 .h files
There is a main.h & .cpp which contains the main program
There is a ListCtrl.h & .cpp which is a wrapper for a listview
There is a Grab.h & .cpp which grabs stuff from a file
There is another .h & .cpp thats not important
Finally there is a custheader.h which has all the <headers> like <string> <map> <vector> etc.
Main.h has all the "headers" in it.
All the other .h files just has "Main.h" included.
All the .h have #ifndef __NAME_H__ #def __NAME_H__ in them to stop them from getting defined multiple times.
Ok now all that works great, except I have a struct that is in Grab.h, and when I try to use it in ListCrtl.h it tells me that the struct isnt defined. Of course when I try to just add the struct to header it tells me its now trying to be redefined. I have tried to include the Grab.h and that doesnt work because it already linked when main.h get compiled.
So how do I fix this up?
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Aug 13th, 2003, 01:25 PM
#2
Frenzied Member
Declare the struct as extern.
-
Aug 13th, 2003, 01:30 PM
#3
Thread Starter
Frenzied Member
I thought of that but when I do that I get error C2159: more than one storage class specified
Here is what the struct looks like, maybe that has something to do with it:
Code:
struct FILE_S
{
string sName;
string sExt;
long lSize;
};
typedef vector<FILE_S> typeFILE;
struct DIR_S
{
bool bScanned;
int iFiles;
long lTotalSize;
int iTXTs;
typeFILE vecFiles;
};
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Aug 13th, 2003, 02:01 PM
#4
Frenzied Member
Didja try:
Code:
#ifndef FILE_TEMPLATE
#define FILE_TEMPLATE
struct FILE_S
{
string sName;
string sExt;
long lSize;
};
typedef vector<FILE_S> typeFILE;
struct DIR_S
{
bool bScanned;
int iFiles;
long lTotalSize;
int iTXTs;
typeFILE vecFiles;
};
#endif
in each of the header files? like grab.h, etc.
-
Aug 13th, 2003, 02:43 PM
#5
Thread Starter
Frenzied Member
Yeah all the headers have that
I see this http://www.codeguru.com/forum/showth...hreadid=231048
I gave it a try using
Code:
class LIST_CL
{
private:
//Functions
//VARs
LV_COLUMN m_lvc;
HWND m_hWnd;
int m_iCols;
public:
//Functions
LIST_CL();
~LIST_CL();
struct p_Point;
bool AddItem(p_Point *File);
}
But I get told that it cant convert from p_Point to DIR_S
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|