Error LNK2019 when using dll maker

Error LNK2019 when using dll maker

yexioamu
Not applicable
247 Views
11 Replies
Message 1 of 12

Error LNK2019 when using dll maker

yexioamu
Not applicable

[ FlexSim 21.2.4 ]

When i implement some function which build in dll release mode, occur a error liked this :

error LNK2019: Unresolved external symbol "__declspec(dllimport) public: __cdecl FlexSim::Map::~Map(void)" (__imp_??1Map@FlexSim@@QEAA@XZ)

what should i do fo it?

0 Likes
Accepted solutions (1)
248 Views
11 Replies
Replies (11)
Message 2 of 12

kavika_faleumu
Autodesk
Autodesk

Microsoft's documentation states that "LNK2019 can occur when a declaration exists in a header file, but no matching definition is implemented. For member functions or static data members, the implementation must include the class scope selector." So, it looks like there's a FlexSim::Map::~Map(void) defined in the header somewhere, but no implementation?

Could you provide more information like what you're implementing and where you're implementing it? Thank you.

Message 3 of 12

JordanLJohnson
Autodesk
Autodesk
Accepted solution

The DLL Maker can only access a limited set of types and functions. The Variant class and Map class are not accessible from the DLL Maker.

If you use the Module SDK, you can access both those classes, as well as many others.

.


Jordan Johnson
Principal Software Engineer
>

Message 4 of 12

yexioamu
Not applicable
When I built it in debug model,it did’t occur the error
0 Likes
Message 5 of 12

kavika_faleumu
Autodesk
Autodesk
0 Likes
Message 6 of 12

kavika_faleumu
Autodesk
Autodesk
@yexioamu, can you share with us what you're trying to do? Maybe that will help us try to replicate your error. Thank you.
0 Likes
Message 7 of 12

yexioamu
Not applicable

Sorry, I will show you tomorrow, I am on a business trip.

Message 8 of 12

yexioamu
Not applicable

My function is simple, this is one of my function in mydll.cpp, it is a simple UUID function:

// C LIBRARY FOR INPUT/OUTPUT STREAMS
#include <stdio.h>
// IN ORDER TO HAVE ACCESS TO FLEXSIM FUNCTIONS, INCLUDE FLEXSIMDEFS.H
#include "FlexsimDefs.h"

#include <iostream>
#include <windows.h>
#include <winhttp.h>
#include <websocket.h>
#include <vector>
#include <time.h>
#include <sys/timeb.h>
#include <string>
#include <atlstr.h>
#include <thread>

#pragma comment(lib, "Websocket.lib")
#pragma comment(lib, "winhttp.lib")
using namespace std;

//#define CHROME_USER_AGENT TEXT("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36")
#define CHROME_USER_AGENT TEXT("Apache-HttpClient/4.5.12 (Java/11.0.6)")


__declspec(dllexport) Variant UUIDF(FLEXSIMINTERFACE)
{
//struct timeb stb;
//::ftime(&stb);
//::srand((unsigned)stb.millitm);

LARGE_INTEGER nStartCounter;
::QueryPerformanceCounter(&nStartCounter);
::srand((unsigned)nStartCounter.LowPart);


//srand((unsigned)time(NULL));
CString strRand;
long long time_last = time(NULL);
struct timeb t1;
ftime(&t1);
long long t2 = t1.time * 100000 + t1.millitm * 100 + rand();
int letter1 = 'A' + rand() % 26;
int letter2 = 'A' + rand() % 26;
int letter3 = 'A' + rand() % 26;

string t3 = to_string(t1.time) + (char)letter1 + (char)letter2 + to_string(t1.millitm) + (char)letter3;

return t3

when i build it in debug model, it builds success, but in release model, it occur the error:

error LNK2019: Unresolved external symbol "__declspec(dllimport) public: __cdecl FlexSim::Map::~Map(void)" (__imp_??1Map@FlexSim@@QEAA@XZ)

and in my other mydll function, it occur in release model too.


0 Likes
Message 9 of 12

kavika_faleumu
Autodesk
Autodesk
After copying your code into a DLL Maker and updating the Solution Properties (i.e., updating the C/C++ Language Standards to use ISO C17 and C++17 and updating the Platform Toolset to use Visual Studio 2019 (v142)), I don't get the LNK2019 error you're getting. Are you sure this is the function throwing the error? I don't see a Map being used in this code, which is what looks to be causing this error somehow.
0 Likes
Message 10 of 12

yexioamu
Not applicable

I use the same C/C++ Language Standards and Platform Toolset as you. In my UUIDF function, i did't used a Map, but it still occur this error, and in my other function which without Map, this LNK2019 error occur too in release model.

0 Likes
Message 11 of 12

kavika_faleumu
Autodesk
Autodesk

@yexioamu, I'm confused as to why you're getting this error and I'm not since we're using the same settings. Would you mind uploading the files you're using? I would like to take a look at them.

If they contain sensitive information, you could make the question private so only certain FlexSim Employees can see them.

0 Likes
Message 12 of 12

julie_weller
Not applicable

Hi @yexioamu, was Jordan Johnson's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes