Zhihao Lin - 2022-07-14

Hi ,
I have some trouble when I use MinGW w64 to link with library built by MSVC.

Code:

#include <stdio.h>
#include "ThostFtdcTraderApi.h"

int main()
{
    auto a = CThostFtdcTraderApi::GetApiVersion();
    printf("%s", a);
}

The library is in the attachment.

Compile:

g++ .\main.cpp -L. -lthosttraderapi_se -DISLIB -DWIN32
ccu8edLo.o:main.cpp:(.text+0x10): undefined reference to `__imp__ZN19CThostFtdcTraderApi13GetApiVersionEv'
collect2.exe: error: ld returned 1 exit status

Compile 2:

g++ .\main.cpp -L. -lthosttraderapi_se
ccSN9a3n.o:main.cpp:(.text+0xe): undefined reference to `CThostFtdcTraderApi::GetApiVersion()'
collect2.exe: error: ld returned 1 exit status

But "CThostFtdcTraderApi::GetApiVersion()" is actually exported by the dll ,why can't mingw detect it?

 

Last edit: Zhihao Lin 2022-07-14