LINK2001 error

LINK2001 error

孙俊博
Participant Participant
338 Views
3 Replies
Message 1 of 4

LINK2001 error

孙俊博
Participant
Participant

I‘m a begginer of objectarx development learner,and I built a new project want to create a simple box ,here is my code 

#include "stdafx.h"
#include "CreateSolids.h"

void CreateSolids::Init() {
    acedRegCmds->addCommand(_T("CreateSolidsCommands"), _T("CreateBox"), _T("CreateBox"), ACRX_CMD_MODAL, CreateBoxFunction);
}

void CreateSolids::Unload() {
    acedRegCmds->removeGroup(_T("CreateSolidsCommands"));
}

void CreateSolids::CreateBoxCommnad() {
    CreateBoxFunction();
}

void CreateSolids::CreateBoxFunction() {
    // box  
    AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();
    AcDbBlockTable* pBlockTable;
    if (pDb->getBlockTable(pBlockTable, AcDb::kForWrite) != Acad::eOk) {
        acutPrintf(_T("Failed to get Block Table.\n"));
        return;
    }

    AcDbBlockTableRecord* pModelSpace = nullptr;
    if (pBlockTable->getAt(ACDB_MODEL_SPACE, pModelSpace, AcDb::kForWrite) != Acad::eOk) {
        acutPrintf(_T("Failed to get Model Space.\n"));
        pBlockTable->close();
        return;
    }

    AcDb3dSolid* pBox = new AcDb3dSolid();
    if (pBox->createBox(10.0, 10.0, 10.0) != Acad::eOk) {
        acutPrintf(_T("Failed to create box.\n"));
        pBox->close();
        pModelSpace->close();
        pBlockTable->close();
        return;
    }

    pModelSpace->appendAcDbEntity(pBox);
    pModelSpace->close();
    pBlockTable->close();
}

errors like this :

1>------ Build started: Project: ArxProject1, Configuration: Release x64 ------
1>CreateSolids.cpp
1>   Creating library x64\Release\JOKERArxProject1.lib and object x64\Release\JOKERArxProject1.exp
1>CreateSolids.obj : error LNK2001: unresolved external symbol "public: static void * __cdecl AcDb3dSolid::operator new(unsigned __int64)" (??2AcDb3dSolid@@SAPEAX_K@Z)
1>CreateSolids.obj : error LNK2001: unresolved external symbol "public: static void __cdecl AcDb3dSolid::operator delete(void *)" (??3AcDb3dSolid@@SAXPEAX@Z)
1>CreateSolids.obj : error LNK2001: unresolved external symbol "public: __cdecl AcDb3dSolid::AcDb3dSolid(void)" (??0AcDb3dSolid@@QEAA@XZ)
1>E:\2_else\TempDocuments\VS\projects\ArxProject1\x64\Release\JOKERArxProject1.arx : fatal error LNK1120: 3 unresolved externals
1>Done building project "ArxProject1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 9:37 and took 03.858 seconds ==========

environment settings:

AutoCad Version: 2026

SDK Version: Latest

editor Version:VS 2022

project settings:

_0-1751074770192.png_1-1751074796520.png

_2-1751074848094.png_3-1751074879215.png

How should I solve this.

0 Likes
Accepted solutions (1)
339 Views
3 Replies
Replies (3)
Message 2 of 4

孙俊博
Participant
Participant

This new project built by this

_0-1751075360106.png

 

0 Likes
Message 3 of 4

daniel_cadext
Advisor
Advisor

try adding this in your StdAfx.h, or somewhere in your code if you don't have that

#pragma comment( lib , "AcPal.lib" )

 

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 4 of 4

孙俊博
Participant
Participant
Accepted solution

I wrote all .lib names into connector-input. and it works