"defined" variable

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
thomasp
Posts: 7
Joined: Wed Jul 23, 2008 2:48 am

"defined" variable

Post by thomasp »

Hi there!

To begin I'm sorry for the spam, I already posted that question in the french forum but (I must be blind) I didn't realized I should have written here.

So :

I'm coding in C++, and I'd like to know if there is a variable i could use in a "#ifdef" preprocessor directive, which would indicate me at compilation time if a space navigator has been installed on the computer.

something like this :

Code: Select all

#ifdef 3DCONNEXION_INSTALLED

//... compile interface code

#endif

Thanks !

Thomas
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

A compilation time switch would be quite limiting, unless you compile your program before every use.
OTOH, you can check at run-time if the driver is running.
thomasp
Posts: 7
Joined: Wed Jul 23, 2008 2:48 am

Post by thomasp »

thank you for your answer


As a matter of fact, I used the Cube3DPolling code to plug my space navigator in my application. But when I tried to compile my project on a computer without 3dconnexion drivers installed, the compiler failed on the line (stdafx.h) :

Code: Select all

#import "progid:TDxInput.Device.1" no_namespace
I think this error is primarily relative to ATL stuff (and indirectly 3dconnexion)
This is why I want to know (at compilation time) if the compilation has a chance to work... or not.

Maybe I should look after an ATL defined variable ?...
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

That "#import" is looking for a registered type library. No driver installed, no type library gets registered.

The libary is TDxInput.dll.

You can:

1) Copy TDxInput.dll localiy
2) Build the code once on a system where the driver is installed and copy the resulting .tlh file

Number 2 works but it isn't recommended.

Number 1 requires you to change the #import to point the file (just like an ordinary #include).

See:
viewtopic.php?p=10945#10945
viewtopic.php?p=2966#2966
viewtopic.php?p=11751#11751
thomasp
Posts: 7
Joined: Wed Jul 23, 2008 2:48 am

Post by thomasp »

Thank you it works now :wink:
Post Reply