[C con Clase] Sé que es una chorrada pero me estoy volviendo loco

iñaki muñoz kukuso en gmail.com
Mie Nov 25 10:10:44 CET 2009


Lo que quiero es compilar este programa



#include <stdio.h>        // Needed for printf etc
#include <objbase.h>    // Needed for COM functionality
#include "XsensCMT.h"
#include <conio.h>        // included for _getch and _kbhit

// this macro tests for an error and exits the program with a message if
there was one
#define EXIT_ON_ERROR(res,comment) if (res != XRV_OK) { printf("Error %d
occurred in " comment ": %s\n",res,cmtGetResultText(res)); exit(1); }

long instance = -1;
// used to signal that the user initiated the exit, so we do not wait for an
extra keypress
int userQuit = 0;

void exitFunc(void)
{
    // if we have a valid instance, we should get rid of it at the end of
the program
    if (instance != -1)
        cmtDestroyInstance(instance);

    // get rid of keystrokes before we post our message
    while (_kbhit()) _getch();

    // wait for a keypress
    if (!userQuit)
    {
        printf("Press a key to exit\n");
        _getch();
    }
}



int main(int argc, char* argv[])
{
    (void) argc; (void) argv;    // Make the compiler stop complaining about
unused parameters

    XsensResultValue res;

    atexit(exitFunc);
    printf("Scanning for connected Xsens devices\n");

    CmtPortInfo portInfo[256];
    unsigned long portCount = 0;
    res = cmtScanPorts(portInfo, &portCount, 0);
    EXIT_ON_ERROR(res,"cmtScanPorts");
    printf("Using port number %d at %d baud\nConnected MT has device Id
%08x\n\n",(long) portInfo[0].m_portNr, portInfo[0].m_baudrate,
portInfo[0].m_deviceId);

    // lets create the cmt instance to handle the sensor
    printf("Creating a CMT instance\n");

    ///// *********  Enter your own serial code here... ie.
"12345-12345-12345-12345"
    ///// The "demo1" serial code has a severely limited number of function
calls per instance,
    ///// which is adequate for this example, but not for production code
    instance = cmtCreateInstance("demo1");
    if (instance != -1)
        printf("CMT instance created!\n\n");
    else
    {
        printf("Creation of CMT instance failed, probably because of an
invalid serial number\n");
        exit(1);
    }

    res = cmtOpenPort(instance, portInfo[0].m_portNr,
portInfo[0].m_baudrate);
    EXIT_ON_ERROR(res,"cmtOpenPort");
    printf("Port opened.\n");

    // set sensor to config sate
    res = cmtGotoConfig(instance);
    EXIT_ON_ERROR(res,"cmtGotoConfig");

    // retrieve the device count
    unsigned short deviceCount;
    printf("Retrieving the device count (this should be 1 for this
example)\n");
    res = cmtGetDeviceCount(instance,&deviceCount);
    EXIT_ON_ERROR(res,"cmtGetDeviceCount");
    printf("Device count is %d\n",(long) deviceCount);

    // retrieve the device ID of the first device
    CmtDeviceId deviceId;
    printf("Retrieving the device ID\n");
    res = cmtGetDeviceId(instance, &deviceId, 0);
    EXIT_ON_ERROR(res,"cmtGetDeviceId");
    printf("Device ID is %08x\n",(long) deviceId);

    // make sure that we get the freshest data
    printf("Setting queue mode so that we always get the latest data\n");
    res = cmtSetQueueMode(instance,CMT_QM_LAST);
    EXIT_ON_ERROR(res,"cmtSetQueueMode");

    // set the device output mode
    printf("Setting the output mode to orientation data in euler angles at
100Hz\n");
    res = cmtSetDeviceMode(instance, CMT_OUTPUTMODE_ORIENT,
CMT_OUTPUTSETTINGS_ORIENTMODE_EULER, 100, deviceId);

    // start receiving data
    res = cmtGotoMeasurement(instance);
    EXIT_ON_ERROR(res,"cmtGotoMeasurement");

    // Wait for first data item(s) to arrive. In production code, you would
use a callback function instead (see cmtSetCallbackFunction)
    Sleep(20);

    // we should have some data by now, so let's see what it holds
    CmtEuler data;
    while(!userQuit && res == XRV_OK)
    {
        res = cmtGetNextDataBundle(instance);
        if (res != XRV_OK)
            break;        // this may happen because we exceeded the maximum
function call count

        res = cmtDataGetOriEuler(instance, &data, deviceId);    // since we
only have one device attached, we don't need to supply the deviceId in most
calls
        if (res != XRV_OK)
            break;        // this may happen because we exceeded the maximum
function call count

        res = cmtDataGetOriEuler(instance, &data, deviceId,NULL );
        printf("Roll: %6.2f Pitch: %6.2f Yaw: %6.2f\n",
data.m_roll,data.m_pitch, data.m_yaw );

        // wait 1 second
        Sleep(1000);

        if (_kbhit())
            userQuit = 1;
    }

    // normally it is nice to destroy the instance, but this is done
automatically when the program exits
    //cmtDestroyInstance(instance);

    return 0;
}


Y estos errores son los que me salen:

3  C:\Program Files\Xsens\Software Development\Examples\Sample_main.cpp
    In file included from C:\Program Files\Xsens\Software
Development\Examples\Sample_main.cpp

A partir de aquí vienen un porron de errores con XsensCMT.h

He instalado los drivers del sensor, he puesto el .h dentro del include C++,
el archivo .dll en la carpeta .DLL y el .lib en la carpeta de lib por si así
funcionaría. Pero nada.

Tambien he intentado hacer lo que comentó Salvador pero no encuentro la
mitad de los archivos que me pide. He instalado, la librería de MySql y los
archivos *libmysql.lib, **reimp.exe, **dlltool.exe, y **as.exe no los
encuentro.

*
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.conclase.net/pipermail/cconclase_listas.conclase.net/attachments/20091125/ae061fb7/attachment.html>


Más información sobre la lista de distribución Cconclase