Jump to content
The simFlight Network Forums

FSUIPC4 and C++


Recommended Posts

Hi,

I'm trying to get a test program running using FSUIPC4 (4.16.2 - downloaded this morning) and the C++ library in the sdk r27.

When I try to build the included sample app, I've been getting complier errors. I got some complaints about the wsprintf statement, and being unable to convert between char and LPWSTR, after I fixed those, I got an error about it not being able to find LIBC.lib.

I tried to create a new project from scratch, with only the main function (without any calls to FSUIPC in it). With only including the FSUIPC_User.h file, I get a whole pile of errors. (see below)

If anyone has been using FSUIPC with C++, I'd love to know how, or what I'm not doing/doing wrong.

Sorry if you're also a member of the forums over at fsdeveloper. I made a similar post there, but I was posting here in hopes of a response, being that's this is a forum dedicated to FSUIPC.

Thanks,

David

Here's the error I'd get:

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(37) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Version'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(39) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_FS_Version'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(41) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Lib_Version'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(41) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(41) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(45) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Open'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(45) : error C2146: syntax error : missing ')' before identifier 'dwFSReq'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(45) : error C2059: syntax error : ')'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(46) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Open2'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(46) : error C2146: syntax error : missing ')' before identifier 'dwFSReq'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(46) : error C2059: syntax error : ')'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(48) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Read'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(48) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(48) : error C2146: syntax error : missing ')' before identifier 'dwOffset'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(48) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(48) : error C2059: syntax error : ')'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(49) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_ReadSpecial'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(49) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(49) : error C2146: syntax error : missing ')' before identifier 'dwOffset'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(49) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(49) : error C2059: syntax error : ')'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(50) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Write'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(50) : error C2146: syntax error : missing ')' before identifier 'dwOffset'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(50) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(50) : error C2059: syntax error : ')'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(51) : error C2146: syntax error : missing ';' before identifier 'FSUIPC_Process'

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(51) : error C2065: 'pdwResult' : undeclared identifier

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(51) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\documents and settings\john\my documents\visual studio 2008\projects\fsuipctest4\fsuipctest4\fsuipc_user. h(51) : fatal error C1903: unable to recover from previous error(s); stopping compilation

:?:

Link to comment
Share on other sites

When I try to build the included sample app, I've been getting complier errors. I got some complaints about the wsprintf statement, and being unable to convert between char and LPWSTR, after I fixed those, I got an error about it not being able to find LIBC.lib.

Different versions of Microsoft C/C++ perform different checks. The "sprintf" problem, for instance, is that it is "deprecated" and they advice you to use "sprintf_s" instead. This is to do with security, as the result of a sprintf can overrun the destimnation buffer. The "_s" variants of many of the string operations are designed to stop this.

Same with a lot of the typing. If you've not yet found any need to use casts when using Microsoft C to write Windows programs you've lived a very sheltered life! I'm afraid there's a lot needed.

The example code in the SDK is intended to be READABLE. It doesn't have all those new complications. However, f you are a C programmer, you will understand them, and therefore will be able to edit your own code to siut your own compiler, whether it be Microsoft or whatever. The examples aren't meant to be YOUR projects, just show you what is involved. You need to know how to use YOUR development system.

If anyone has been using FSUIPC with C++, I'd love to know how, or what I'm not doing/doing wrong.

I think you are not understanding the evolution of C in the hands of Microsoft. Just learn the rules for your specific version and you'll be able to eliminate the warnings and errors. We've all had to do it.

Oh, one other thing. The C examples in the SDK are C, not C++, though the Header does have a "C" declaration so it can be used in C++. The errors you list in FSUIPC_User.h appear to be due to the omission of the BOOL typedef. Did you forget to include the Windows.h before including the FSUIPC header?

Sorry if you're also a member of the forums over at fsdeveloper. I made a similar post there, but I was posting here in hopes of a response, being that's this is a forum dedicated to FSUIPC.

I can only post the same there.

Regards

Pete

Link to comment
Share on other sites

Ooops! Sorry. I did my usual trick and replied to your last message using the "Edit" button instead of the "Quote" button. Hence your message got squished. Sorry.

I've spent the last several years doing Java programming, so many of the Microsoft peculiarities of C/C++ aren't yet second nature to me.

Well, I also find a lot of the stuff rather, er, arcane, to say the least. It isn't intuitive at all. Trial and error, with a capital ERROR, is the usual path taken.

I think most of your compile errors will be down to a missing header (probably windows.h as I said) defining some of the types. A lot of the others will be "deprecated" library functions, like sprintf, strcpy, etc, and stronger typecasting in the more recent Microsoft development packages.

Regards

Pete

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.