Windows aplication with Visual C++ 2008!

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

Post Reply
mhserrano
Posts: 45
Joined: Tue Dec 11, 2007 8:24 pm
Location: Torres Vedras, Portugal

Windows aplication with Visual C++ 2008!

Post by mhserrano »

Hi people, good evening.

I´ve received my IOW40 starter-kit and it is ok, well mounted, it answers right to all the sample programs supplied in CD-ROM.

My problem now is interact with all the features that IOW40 can do for me, especially the switch matrix and led matrix. I´m trying to build a simple Radio Module for use within Flight Simulator.

I´m a very very newbie in programing languages, but one thing i know is i must have a windows aplication, just a little program to manage IOW40 switches and leds support. These program must talk with FSUIPC, an interface progam who give us the possiblity to interact with Flight Simulator internal variables.

My questions are:

Is Visual C++ the best program to write these kind of program?

The IOWarrior API works with these program? I tried to build, for example, the SimpleIO sample program, provided in the CD-ROM, and the compiler returned about 150 errors :?

In API documentation refers sample code examples for most functions to be used (like IowKitOpenDevice). These examples are just for C language or can be used with C++?

Thanks in advance.

Marco Serrano
User avatar
Christoph Jung
Posts: 670
Joined: Sun Oct 08, 2006 3:43 pm
Location: Germany / Berlin
Contact:

Post by Christoph Jung »

Yes you can use Visual Studio 2008 for creating your tools.

Have you include the "IOWKIT.LIB" and "IOWKIT.H" to the project? This is nessasary for use our IowKit-API.

The IOWKIT.LIB must be insert to the "Linkersettings" and the IOWKIT.H in the project File (f.e. projectDlg.h).
Abteilung: Softwareentwicklung
Folge uns auf Twitter
Follow us on twitter
Elektron
Posts: 19
Joined: Tue Sep 30, 2008 12:57 am

Re: Windows aplication with Visual C++ 2008!

Post by Elektron »

Hello mhserrano,

Actually, Visual Studio is fine. In order to compile the programs provided on disk, the compiler has to know how these "special functions" that are being used in order to interact with your IOWarrior do work, because they are not part of the programming language themselves.

What developers do, is providing a library(*.lib, *.a). A library is a file containing the pre-compiled routines. Since the library is linked to your program after the program being compiled, the compiler has to know which functions are legal to use. That is what you need a header for (usually ending on *.h, but I have seen *.hpp, too). A header file simply lists what functions will be linked afterwards. You have to include it before any usage:

Code: Select all

#include <bla1.h>
#include "bla2.h"
As you can see, I have used <> and "". <> means the requested file will be in the standard include folder of your compiler, "" indicates the compiler has to look for it in the same folder the *.c/*.cpp - file is in. # indicates it's a pre-processor directive. The pre-processor will replace this line with the content of the header file before compiling, so basically you save lots of typing. Usually this is done in the example programs, so there is no need to care for it.

The second thing is, you have to care to link the program you have compiled to the library. Otherwise you would have told the compiler there are functions defined and you are going to link them, so it compiles fine. But the linker does not have a library to link to.

edit:
By the way, I am using Dev-Cpp for development. Sadly, the developers stopped working on it, but it is still great, stable and free. Go here:

http://www.bloodshed.net/dev/devcpp.html

Then choose "Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC". MingW is the compiler, whereas Dev-Cpp is an IDE. In case you want to compile any of the example projects, create a "Console Application" by clicking on File->New->Project. Remove the source that has been created automatically and save it. Then hit Project->Add To Project to add the source and header files. In order to link with a library, choose Project->Project Options->Parameters. On the very right there is a button "Add Library Or Object". Hit it and navigate to the projects folder, if you're not in it automatically and choose "IOWKit.lib". It should now appear in the Linker-Section. Hit "OK" and press "Ctrl+F9" to compile.
mhserrano
Posts: 45
Joined: Tue Dec 11, 2007 8:24 pm
Location: Torres Vedras, Portugal

Re: Windows aplication with Visual C++ 2008!

Post by mhserrano »

Thanks Elektron!!

In the past few months i didn´t "touch" anything about programming my own application to interact with iow40. I think its too difficult to me because i dont have enough skills of programming to do that job. But i will try again later!!

I think it shouldn´t be very difficult to write the code, based on iow API, for a simple application running under windows xp, and with some functions about turning on/off some led´s, controlling a switch matrix, etc.

In my first attempts i used dev-cpp, it looked nice and smooth but a bit limited.

Best Regards,

MS
Post Reply