dllimport and dlliexport issue in VC++ 2008

I am migrating VC++ 6 to Vc++ 2009.

#if defined(BUILDING_WFLWORKFLOW_DLL)
      #define WFL_EXPORT __declspec(dllexport)
#else
      #define WFL_EXPORT __declspec(dllimport)
#endif



ostream&      WFL_EXPORT operator<<( ostream& a_rOstream,            const wflSystemTime& a_rSystemTime);

      friend ostream&      WFL_EXPORT operator<<( ostream& a_rOstream,            const wflSystemTime& a_rSystemTime);

Compilation Error:

 error C2059: syntax error : '__declspec(dllexport)'
 error C2059: syntax error : '__declspec(dllexport)'
error C2238: unexpected token(s) preceding ';
bobbeyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pgnatyukCommented:
Should it be like that:
friend WFL_EXPORT ostream& operator<<( ostream& a_rOstream, const wflSystemTime& a_rSystemTime);

Are you sure you included windows.h file?

Check if this MSDN article will help:
http://support.microsoft.com/kb/117687
0
pgnatyukCommented:
0
pgnatyukCommented:
Sorry. :)
My previous comment is not for this thread.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

bobbeyAuthor Commented:
I  havethe freind  function defined already.
friend WFL_EXPORT ostream& operator<<( ostream& a_rOstream, const wflSystemTime& a_rSystemTime);

Included window.h and still gtting the same error
0
bobbeyAuthor Commented:
the freid function

friend wflSystemTime WFL_EXPORT  operator-(  wflSystemTime a_LeftSystemTime, wflSystemTime a_RightSystemTime);
      friend ostream&      WFL_EXPORT    operator<<( ostream& a_rOstream,            const wflSystemTime& a_rSystemTime);

But your suggestion
friend WFL_EXPORT ostream& operator<<( ostream& a_rOstream, const wflSystemTime& a_rSystemTime);
0
pgnatyukCommented:
I didn't understand the last comments.
So
friend WFL_EXPORT ostream& operator<<( ostream& a_rOstream, const wflSystemTime& a_rSystemTime);

works fine?
If it doesn't, what is the error?
0
bobbeyAuthor Commented:
pgnatyuk:,
It didnt work. I stopped this work for a while,
0
pgnatyukCommented:
Ok. Close the question.
0
bobbeyAuthor Commented:
In my VC++ 6 code, there is
#if _MSC_VER >= 1000
#pragma once
#endif

should I need to change this for VC++ 2008
0
bobbeyAuthor Commented:
pgnatyuk,
Compiler pointing to the following lines and the errors are
 
compiler error
friend WFL_EXPORT ostream& operator<<( ostream& a_rOstream, const wflSystemTime& a_rSystemTime);

error C2059: syntax error : '__declspec(dllexport)'
 
error C2238: unexpected token(s) preceding ';'

ostream& WFL_EXPORT operator<<( ostream& a_rOstream, const wflSystemTime& a_rSystemTime);
error C2059: syntax error : '__declspec(dllexport)'
0
pgnatyukCommented:
?
I thought we agreed to close the question. I cannot comment here - I have to press "Object" button.
I do not see this file. In my first comment here I asked if you included the windows.h file. You have to check what you included there and how you declared WFL_EXPORT. In the worst case remove all #ifdef aroung this WFL_EXPORT and compile. I've posted this link:
http://msdn.microsoft.com/en-us/library/a90k134d(VS.80).aspx



0
bobbeyAuthor Commented:
windows.h  inclueded.
in the header file:
#if defined(BUILDING_WFLWORKFLOW_DLL)
      #define WFL_EXPORT __declspec(dllexport)
#else
      #define WFL_EXPORT __declspec(dllimport)
#endif
BUILDING_WFLWORKFLOW_DLL is defined in the preprocessor settings.
But in the code, if part is greyed.
0
pgnatyukCommented:
>>But in the code, if part is greyed.
I didn't understand this sentence.

For a test add manually:
#define BUILDING_WFLWORKFLOW_DLL
Before this #if defined(BUILDING_WFLWORKFLOW_DLL)
and tell me what's going on.

I hope, now you are compiling the DLL, not an executable that calls this DLL. So you need to declare the export - so I ask to add:
#define BUILDING_WFLWORKFLOW_DLL

So you exported functions will be declared as:
__declspec(dllexport) void __cdecl Function1(void);

For a test you can comment all other functions and add only this one above (in the same file where you have this WFL_EXPORT defined) - it will allow to check the code.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pgnatyukCommented:
Unfortunately, I cannot say that it is a pleasure to answer on your questions. I will stay out of them in the future. I think, other experts will help you better.
0
bobbeyAuthor Commented:
pgnatyuk:

I am sorry for all. I was very new to EE and didn't know much aout the rules.   I am very thankful for your valuable help.
0
bobbeyAuthor Commented:
T
0
pgnatyukCommented:
Thank you. And sorry. I was wrong about you and my previous comment is not correct.
I wish you good luck and all the best.
0
bobbeyAuthor Commented:
thanks pgnatyuk:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.