Author Topic: Linking error for the AcDbSpline constructor  (Read 3019 times)

0 Members and 1 Guest are viewing this topic.

Andrey Bushman

  • Swamp Rat
  • Posts: 860
Linking error for the AcDbSpline constructor
« on: August 30, 2013, 08:57:16 AM »
AutoCAD 2014 x64;

Message:
Quote
Error   1   error LNK2019: unresolved external symbol "__declspec(dllimport) private: static void * __cdecl AcHeapOperators::allocRawMem(unsigned __int64)" (__imp_?allocRawMem@AcHeapOperators@@CAPEAX_K@Z) referenced in function "public: static void * __cdecl AcHeapOperators::operator new(unsigned __int64)" (??2AcHeapOperators@@SAPEAX_K@Z)   C:\Users\user\documents\visual studio 2012\Projects\spline_test\spline_test\main.obj

Error   2   error LNK2019: unresolved external symbol "__declspec(dllimport) private: static void __cdecl AcHeapOperators::freeRawMem(void *)" (__imp_?freeRawMem@AcHeapOperators@@CAXPEAX@Z) referenced in function "public: static void __cdecl AcHeapOperators::operator delete(void *)" (??3AcHeapOperators@@SAXPEAX@Z)   C:\Users\user\documents\visual studio 2012\Projects\spline_test\spline_test\main.obj

Error   3   error LNK1120: 2 unresolved externals   C:\Users\user\documents\visual studio 2012\Projects\spline_test\x64\Debug\spline_test.arx

My code (problem is marked in the comment):
Code - C++: [Select]
  1. AcDbObjectId create_spline(){
  2.         AcDbHostApplicationServices* appsrv = acdbHostApplicationServices();
  3.         AcDbDatabase* wdb = appsrv->workingDatabase();
  4.  
  5.         AcDbBlockTable* pBlockTable;
  6.         wdb->getSymbolTable(pBlockTable, AcDb::kForRead);
  7.         AcDbBlockTableRecord* pBlockTableRecord;
  8.         pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,AcDb::kForWrite);
  9.         pBlockTable->close();
  10.        
  11.         AcGePoint3dArray ar;
  12.         ar.append(AcGePoint3d(100,200,0));
  13.         ar.append(AcGePoint3d(150,100,0));
  14.         ar.append(AcGePoint3d(200,200,0));
  15.         ar.append(AcGePoint3d(250,100,0));
  16.        
  17.         AcDbSpline* pSpline = new AcDbSpline(ar); // The problem is here!
  18.  
  19.         AcDbObjectId splineId; 
  20.         pBlockTableRecord->appendAcDbEntity(splineId,pSpline);
  21.     pBlockTableRecord->close();
  22.     pSpline->close();
  23.  
  24.     return splineId;
  25. }
  26.  

Quote from: ObjectARX 2014 SDK
Code - C++: [Select]
  1. AcDbSpline(
  2.     const AcGePoint3dArray& fitPoints,
  3.     int order = 4,
  4.     double fitTolerance = 0.0
  5. );
This constructor has been deprecated and will be removed in a future release.
But now it exists still...

I don't understand a cause of error. :(

Can anybody help me?

Thank you.

Alexander Rivilis

  • Bull Frog
  • Posts: 212
  • Programmer from Kyiv (Ukraine)
Re: Linking error for the AcDbSpline constructor
« Reply #1 on: August 30, 2013, 10:13:44 AM »
ac1st19.lib have to be linked

owenwengerd

  • Bull Frog
  • Posts: 439
Re: Linking error for the AcDbSpline constructor
« Reply #2 on: August 30, 2013, 10:14:53 AM »
The error is caused by using a library function, but not linking to the library where the function is defined. The AcHeapOperators member functions are defined in ac1st19.lib from the ObjectARX SDK.

Andrey Bushman

  • Swamp Rat
  • Posts: 860
Re: Linking error for the AcDbSpline constructor
« Reply #3 on: August 30, 2013, 10:17:38 AM »
owenwengerd, Alexander Rivilis
Thank you!