By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,332 Members | 1,404 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,332 IT Pros & Developers. It's quick & easy.

using C structure in C++ (VC++ 7)

P: n/a
When I declare variable:

ZCL ZpZCL; (ZCL is defined in api.h/api.c)

in definition my C++ class, I get 'missing storage type or type
specifiers' Why?

I tried include this way:
#include "../api.h"
and with extern "C"

regards,
JN
Dec 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jarek wrote:
When I declare variable:

ZCL ZpZCL; (ZCL is defined in api.h/api.c)

in definition my C++ class, I get 'missing storage type or type
specifiers' Why?

I tried include this way:
#include "../api.h"
and with extern "C"

regards,
JN


Post a minimal code sample that demonstrates the problem. (You may need
to copy and paste part of api.h, too.)

Cheers! --M

Dec 19 '05 #2

P: n/a
Jarek wrote:
When I declare variable:

ZCL ZpZCL; (ZCL is defined in api.h/api.c)
And WTF is 'api.h/api.c'?
in definition my C++ class, I get 'missing storage type or type
specifiers' Why?
Unknown. Read the FAQ 5.8.
I tried include this way:
#include "../api.h"
and with extern "C"


OK. Still unable to help you.

V
Dec 19 '05 #3

P: n/a
Jarek wrote:
When I declare variable:

ZCL ZpZCL; (ZCL is defined in api.h/api.c)

in definition my C++ class, I get 'missing storage type or type
specifiers' Why?
Because type ZCL is not defined yet:

http://msdn.microsoft.com/library/de...html/C2501.asp

I tried include this way:
#include "../api.h"
and with extern "C"
Does not matter how you include. Check for circular include -> if header
myclass.h (where you are declaring your class) is also included from
api.h, that would make the api.h declarations undefined during parsing
myclass.h

Try the following; At ZCL declarations define macro:

#define ZCL_DEFINED 1

class ZCL // ...

and then before offending line try this:

#ifdef ZCL_DEFINED
#error "ZCL is defined"
#else
#error "ZCL is not defined"
#endif

ZCL ZpZCL;

regards,
JN

Dec 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.