C library linkage problem

C, C++, and Visual C++
kkennett

C library linkage problem

Postby kkennett » Thu Jun 04, 2009 3:53 pm

I wrote this simple program:
______________________________

#include <stdio.h>
#include <windows.h>
#include "phidget21.h"

CPhidgetAccelerometerHandle theAccel;

int main(int argc, char **argv)
{
int err = CPhidgetAccelerometer_create(&theAccel);
if (err)
{
printf("Error = %d during create.\r\n",err);
return -1;
}

CPhidget_close((CPhidgetHandle)theAccel);

return 0;
}
______________________________

When I built it I get:

1>Linking...
1>main.obj : error LNK2019: unresolved external symbol __imp__CPhidget_close@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__CPhidgetAccelerometer_create@4 referenced in function _main
1>C:\Dev\phid1\Debug\phid1.exe : fatal error LNK1120: 2 unresolved externals

I looked in the phidget21.h header, and see:

__declspec (dllimport)
int __stdcall CPhidgetAccelerometer_create (CPhidgetAccelerometerHandle * phid);

using __stdcall will make the export as indicated in the error message.

Did I do something wrong or is the library linked differently from what its header says it is linked as.

kkennett

Re: C library linkage problem

Postby kkennett » Thu Jun 04, 2009 5:12 pm

ok. my bad.

i was trying to link a 32-bit program with the 64-bit libraries.

sorry!~


Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 1 guest