I am trying to compile a code example from a hardware protection key
supplier.
The example should compile but does not on my VS2005 installation.
I suspect that I have not done something I need to do inside the
VS2005 IDE, but being a complete novice in C++ and Visual Studio 2005
I don't know what it can be....

The first problem was that it stopped on this include line:
#include <istream.h>
saying the file could not be found.

After looking in the VC/include dir below VS2005 I found a file called
istream (no extension), which seemed to be a header file so I renamed
it to istream.h.

Next I received no less than 10 errors (lines wrapped due to
newsreader):

1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(72) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(73) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(76) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(77) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(84) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(91) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(100) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(108) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(116) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(124) : error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int

If I doubleclick the first error I get to this piece of code:

extern __declspec(dllexport) WINAPI SAFEInitGlobal(unsigned char*);
typedef (WINAPI *TSafeInitGlobalFnPtr)(unsigned char*);


extern __declspec(dllexport) WINAPI DecodeKeyID(
unsigned char*,
char*,
RESULTREC*,
unsigned short*);
typedef (WINAPI *TDecodeKeyIDFnPtr)(unsigned
char*,char*,RESULTREC*,unsigned short*);

extern __declspec(dllexport) WINAPI GenerateUpdateStr(
unsigned char *GlobPtr,
SAFECOMMANDREC *safe_commands,
short count,
char *updateStr,
PROD_LIST *prod_list_ptr,
BOOL ScrambleOrder);

As far as I can see there are no unspecified types anywhere here, so
what is the problem????

Now I am at road's end, I have not a single clue as to why the errors
happen. Apparently this compiles fine in an earlier version of VS
(when I load the project it says it has to convert to the new format
and I cannot go back to the old environment afterwards).

Any help appreciated!
(Bear in mind that I am not used to working with VS2005, I have only
worked with VB6 (a lot) and Borland products....

/Bo


Bo Berglund
bo.berglund(at)nospam.telia.com

Re: VC2005 cannot build project, complains about missing items... by Alex

Alex
Sun May 27 06:58:13 CDT 2007

Bo Berglund wrote:
> I am trying to compile a code example from a hardware protection key
> supplier.
> The example should compile but does not on my VS2005 installation.
[...]
> The first problem was that it stopped on this include line:
> #include <istream.h>
> saying the file could not be found.
>
> After looking in the VC/include dir below VS2005 I found a file called
> istream (no extension), which seemed to be a header file so I renamed
> it to istream.h.

It seems that the example is for VC++6.0. Nowadays "xxx.h"
stream headers are deprecated and not used anymore. Streams
are part of Standard C++ Library and should be included as
any other facility:

#include <istream>

It's bad idea to rename library's header file, since other
components may include it, too.

> Next I received no less than 10 errors (lines wrapped due to
> newsreader):
>
> 1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(72) : error
> C4430: missing type specifier - int assumed. Note: C++ does not
> support default-int
[...]
> If I doubleclick the first error I get to this piece of code:
>
> extern __declspec(dllexport) WINAPI SAFEInitGlobal(unsigned char*);

Most likely you get this error due to `WINAPI' token. Ensure
that you have Platform SDK properly installed and integrated
with Visual C++. If you use Express edition of VS, then read
here for additional info:

"Using Visual C++ 2005 Express Edition with the Microsoft
Platform SDK"
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

Also, don't forget to include <windows.h>. However, it
should be arranged for you by IDE's wizard anyway.

I assume that you have installed protection key SDK and made
it available for the project.

> (Bear in mind that I am not used to working with VS2005, I have only
> worked with VB6 (a lot) and Borland products....

Speaking about compilation and linking, Borland's products
based on same basic principles. You need header files in
order to compile and lib/obj files in order to link. All you
need to do is to specify relevant directories in IDE where
compiler/linker can find required files.

Alex

Re: VC2005 cannot build project, complains about missing items... by Bo

Bo
Sun May 27 13:58:07 CDT 2007

On Sun, 27 May 2007 14:58:13 +0300, Alex Blekhman <xfkt@oohay.moc>
wrote:

>It seems that the example is for VC++6.0. Nowadays "xxx.h"
>stream headers are deprecated and not used anymore. Streams
>are part of Standard C++ Library and should be included as
>any other facility:

Right, I happened to have VC++6 installed as well so I loaded the
example into that and sure enough it built OK.

>#include <istream>
>
>It's bad idea to rename library's header file, since other
>components may include it, too.

What i did was to copy all files without extensions to a new dir and
in tha I added the .h extension. Then I set VS2005 to look into this
dir as the last one on the list..

>> Next I received no less than 10 errors (lines wrapped due to
>> newsreader):
>>
>> 1>c:\engineering\projects\bosse\safenet\spquery\dsdll.h(72) : error
>> C4430: missing type specifier - int assumed. Note: C++ does not
>> support default-int
>[...]
>> If I doubleclick the first error I get to this piece of code:
>>
>> extern __declspec(dllexport) WINAPI SAFEInitGlobal(unsigned char*);
>
>Most likely you get this error due to `WINAPI' token. Ensure
>that you have Platform SDK properly installed and integrated
>with Visual C++. If you use Express edition of VS, then read
>here for additional info:

I have the full MSDN edition (been an MSDN member for 12 years now).
Using this I have been abvle to build other applications (open-source
apps) without these problems. But the open source projects probably
have a more careful file layout with defines to cure problems arising
from various VS versions..


Thanks,
Bo

Bo Berglund
bo.berglund(at)nospam.telia.com

Re: VC2005 cannot build project, complains about missing items... by David

David
Sun May 27 14:13:51 CDT 2007

Alex Blekhman wrote:
> Bo Berglund wrote:
>> I am trying to compile a code example from a hardware protection key
>> supplier.
>> The example should compile but does not on my VS2005 installation.
> [...]
>> The first problem was that it stopped on this include line:
>> #include <istream.h>
>> saying the file could not be found.
>>
>> After looking in the VC/include dir below VS2005 I found a file called
>> istream (no extension), which seemed to be a header file so I renamed
>> it to istream.h.
>
> It seems that the example is for VC++6.0. Nowadays "xxx.h" stream
> headers are deprecated and not used anymore. Streams are part of
> Standard C++ Library and should be included as any other facility:
>
> #include <istream>
>
> It's bad idea to rename library's header file, since other components
> may include it, too.

Bo/Alex:

VC6 would accept the new iostream library (or the old one, provided you
did not mix them). So this is not an issue of "the example is for VC6",
but rather "this code is obsolete, and should not compile".

Ask the supplier for a corrected version of the code. It is very easy to
write code that will compile on both VC6 and VC8.

--
David Wilkinson
Visual C++ MVP