-
March 8th, 2006, 10:57 PM
#1
DLL file error
Dear all
I'm learning about dll in MFC from my workplace. This dll was created by senior programmer. I try learn this dll and write it back into the new one.
But, when I compile 1 file. I have a lot of error even it is same as original.
this is header file
Code:
// Book.h : interface of the CBook class
#pragma once
#include "MawarCore\MawarFlit\FBSocket.h"
#include "MawarCore\MawarCtrl\DataBitmap.h"
#include "MawarCore\MawarFlit\Card.h"
#include "AkmalDataDefs.h"
class AKMAL_DATA_API CBook : public CCard
{
public:
int m_PictureID;
int m_BookAttr;
int m_Reserved[20];
public:
// function
CBitmapBin* GetBitmap(CFBSocket* pEmpSock, CRecordHnd* phBuff);
bool DeleteBitmap(CFBSocket* pEmpSock);
public:
CBook(void);
~CBook(void);
};
and this is .cpp file
Code:
// Book.cpp : implementation of the CBook class
#include "StdAfx.h"
#include "Book.h"
/////////////////////////////////////////////////////////////////////////////////
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
/////////////////////////////////////////////////////////////////////////////////
// construction/destruction
/////////////////////////////////////////////////////////////////////////////////
CBook::CBook(void)
{
}
CBook::~CBook(void)
{
}
CBitmapBin* CBook::GetBitmap(CFBSocket* pEmpSock, CRecordHnd* phBuff)
{
if(m_PictureID != 0)
{
CBitmapBin* pBin = (CBitmapBin*)pEmpSock->ReadRecord(phBuff, MRT_PICTDATA, m_PictureID);
if(pBin != NULL)
return pBin;
LogError("Missing picture........");
}
return NULL;
}
bool CBook::DeleteBitmap(CFBSocket *pEmpSock)
{
if(m_PictureID != 0)
{
pEmpSock->ReadRecord(MRT_PICTDATA, m_PictureID);
m_PictureID = 0;
}
return true;
}
The error is
1. error C2332: 'class' : missing tag name
2. error C2011: '__unnamed' : 'enum' type redefinition
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShlObj.h(4476) : see declaration of '__unnamed'
3. error C2470: 'CBook' : looks like a function definition, but there is no formal parameter list; skipping apparent body
4. error C2059: syntax error : 'public'
5. error C2653: 'CBook' : is not a class or namespace name
6. warning C4508: 'CBook' : function should return a value; 'void' return type assumed
7. error C2653: 'CBook' : is not a class or namespace name
8. error C2084: function 'int CBook(void)' already has a body
c:\Documents and Settings\Rokman\My Documents\Visual Studio Projects\Akmal Project Suite\Library\Akmal-Data\Book.cpp(17) : see previous definition of 'CBook'
9. error C2653: 'CBook' : is not a class or namespace name
and a few more like the class never declare......
Can anybody explain to me what all of this error mean????
ps : I really appreciate who can explain this to me..... tq
MFC & VC++ newbie
-
March 9th, 2006, 04:24 AM
#2
Re: DLL file error
Is AKMAL_DATA_API somewhere defined?
-
March 11th, 2006, 11:02 PM
#3
Re: DLL file error
I think defined it already... is it we define it in Definition file right.
this is the file AkmalDataDefs.def
Code:
#pragma once
#ifdef _AKMAL_DATA_EXP
#define AKMAL_DATA_API __declspec(dllexport);
#else
#define AKMAL_DATA_API __declspec(dllimport);
#endif
Is it right???
MFC & VC++ newbie
-
March 12th, 2006, 04:07 AM
#4
Re: DLL file error
this is the file AkmalDataDefs.def
Did you mean AkmalDataDefs.h?
-
March 12th, 2006, 05:49 AM
#5
Re: DLL file error
Code:
#pragma once
#ifdef _AKMAL_DATA_EXP
#define AKMAL_DATA_API __declspec(dllexport);
#else
#define AKMAL_DATA_API __declspec(dllimport);
#endif
have u include AKMAL_DATA_API header file ? try it.
If I Helped You, "Rate This Post"
Thanks
Guna
-
March 12th, 2006, 10:10 PM
#6
Re: DLL file error
Originally Posted by cilu
Did you mean AkmalDataDefs.h?
Oppss Sorry. It's not .def
Yes, It's AkmalDataDefs.h <---Defines the entry point for the DLL application.
Even I have put this header into .cpp also cannot. You can see it in my 1st post above.
MFC & VC++ newbie
-
March 13th, 2006, 02:45 AM
#7
Re: DLL file error
It looks like there is something wrong before the class definition...in other words...in one of the included files...
Code:
#include "MawarCore\MawarFlit\FBSocket.h"
#include "MawarCore\MawarCtrl\DataBitmap.h"
#include "MawarCore\MawarFlit\Card.h"
-
March 13th, 2006, 03:02 AM
#8
Re: DLL file error
This error might be significant....
Originally Posted by pusak82
2. error C2011: '__unnamed' : 'enum' type redefinition
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShlObj.h(4476) : see declaration of '__unnamed'
The code you posted doesn't contain any symbol called __unnamed - therefore it's most likely to be getting included by one (or probably, more than one) of the included headers.
Check that you haven't got 2 header files that mutually include each other. For example, if DataBitmap.h includes Card.h, then Card.h shouldn't include DataBitmap.h
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
March 20th, 2006, 01:43 AM
#9
Re: DLL file error
Until now I still cannot solve this prob....
Code:
class AKMAL_DATA_API CBook : public CCard
{
public:
int m_PictureID;
int m_BookAttr;
int m_Reserved[20];
public:
// function
CBitmapBin* GetBitmap(CFBSocket* pEmpSock, CRecordHnd* phBuff);
bool DeleteBitmap(CFBSocket* pEmpSock);
public:
CBook(void);
~CBook(void);
};
the error is :
c:\Documents and Settings\Rokman\My Documents\Visual Studio Projects\Akmal Project Suite\Library\Akmal-Data\Book.h(10): error C2332: 'class' : missing tag name
Can any body solve this prob, I think compiler cannot read the declaration class type....
I don't what to do right now...
MFC & VC++ newbie
-
March 20th, 2006, 02:01 AM
#10
Re: DLL file error
If I Helped You, "Rate This Post"
Thanks
Guna
-
March 20th, 2006, 02:29 AM
#11
Re: DLL file error
After I study the code...
I detect the error starts is on AKMAL_DATA_API on declaration class in header file...
Any one know how to make AKMAL_DATA_API validate to use....
it's the definition file right...
ps : Sorry I just now a little about DLL file...still on a route to understand it..
MFC & VC++ newbie
-
March 20th, 2006, 03:22 AM
#12
Re: DLL file error
Code:
#ifdef _AKMAL_DATA_EXP
#define AKMAL_DATA_API __declspec(dllexport);
#else
#define AKMAL_DATA_API __declspec(dllimport);
#endif
I don't know if that was your error or somebody else's - but you shouldn't be using semi-colons here. The correct syntax is:-
Code:
#ifdef _AKMAL_DATA_EXP
#define AKMAL_DATA_API __declspec(dllexport)
#else
#define AKMAL_DATA_API __declspec(dllimport)
#endif
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
March 20th, 2006, 10:15 PM
#13
Re: DLL file error
Tq very much John E, ur correction make my code compile successfully...
After that, there was no error anymore....
Why I not aware of this semi colons...
Tq very much John E
ps : Next time I need to be careful write a code...
MFC & VC++ newbie
-
March 21st, 2006, 07:42 AM
#14
Re: DLL file error
Glad to be of help....
"A problem well stated is a problem half solved.” - Charles F. Kettering
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
|