简体   繁体   中英

ASIOSDK; Error when building mex file from hostsample.cpp

I'm writing a c++ file to build into mex, but I got the unsolved external symbol errors with asio function like "ASIOExit". I'm building in Matlab console with mex command. I've put all headfiles and cppfiles from the AsioSDK. into one folder ad used -I to include that folder. What else do I need to include or link?

The 3 headfiles related to ASIO has already been added in include.

#include "asiosys.h" 
#include "asio.h"
#include "asiodrivers.h"

Error using mex Creating library hostsample.lib and object hostsample.exp hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOInit(struct ASIODriverInfo *)" (?ASIOInit@@YAJPEAUASIODriverInfo@@@Z) referenced in function mexFunction hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOExit(void)" (?ASIOExit@@YAJXZ) referenced in function mexFunction hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOStart(void)" (?ASIOStart@@YAJXZ) referenced in function mexFunction hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOStop(void)" (?ASIOStop@@YAJXZ) referenced in function mexFunction hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOGetChannels(long *,long *)" (?ASIOGetChannels@@YAJPEAJ0@Z) referenced in function " long __cdecl init_asio_static_data(struct DriverInfo *)" (?init_asio_static_data@@YAJPEAUDriverInfo@@@Z) hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOGetLatencies(long *,long *)" (?ASIOGetLatencies@@YAJPEAJ0@Z) referenced in function "long __cdecl create_asio_buffers(struct DriverInfo *)" (?create_asio_buffers@@YAJPEAUDriverInfo@@@Z) hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOGetBufferSize(long *,long *,long *,long *)" (?ASIOGetBufferSize@@YAJPEAJ000@Z) referenced in function "long __cdecl init_asio_static_data(struct DriverInfo *)" (?init_asio_static_data@@YAJPEAUDriverInfo@@@Z) hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOGetSampleRate(double *)" (?ASIOGetSampleRate@@YAJPEAN@Z) referenced in function "long __cdecl init_asio_static_data(struct DriverInfo *)" (?init_asio_static_data@@YAJPEAUDriverInfo@@@Z) hostsampl e.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOSetSampleRate(double)" (?ASIOSetSampleRate@@YAJN@Z) referenced in function "long __cdecl init_asio_static_data(struct DriverInfo *)" (?init_asio_static_data@@YAJPEAUDriverInfo@@@Z) hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOGetSamplePosition(struct ASIOSamples *,struct ASIOTimeStamp *)" (?ASIOGetSamplePosition@@YAJPEAUASIOSamples@@PEAUASIOTimeStamp@@@Z) referenced in function "void __cdecl bufferSwitch(long,long)" (?bufferSwitch@@YAXJJ@Z) hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOGetChannelInfo(struct ASIOChannelInfo *)" (?ASIOGetChannelInfo@@YAJPEAUASIOChannelInfo@@@Z) referenced in function "long __cdecl create_asio_buffers(struct DriverInfo *)" (?create_asio_buffers@@YAJPEAUDriverInfo@@@Z) hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOCreateBuff ers(struct ASIOBufferInfo *,long,long,struct ASIOCallbacks *)" (?ASIOCreateBuffers@@YAJPEAUASIOBufferInfo@@JJPEAUASIOCallbacks@@@Z) referenced in function "long __cdecl create_asio_buffers(struct DriverInfo *)" (?create_asio_buffers@@YAJPEAUDriverInfo@@@Z) hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIODisposeBuffers(void)" (?ASIODisposeBuffers@@YAJXZ) referenced in function mexFunction hostsample.obj: error LNK2019: unresolved external symbol "long __cdecl ASIOOutputReady(void)" (?ASIOOutputReady@@YAJXZ) referenced in function "struct ASIOTime * __cdecl bufferSwitchTimeInfo(struct ASIOTime *,long,long,class std::vector

,class std::allocator > > >)" (?bufferSwitchTimeInfo@@YAPEAUASIOTime@@PEAU1@JJV?$vector@V?$vector@NV?$allocator@N@std@@@std@@V?$allocator@V?$vector@NV?$allocator@N@std@@@std@@@2@@std@@@Z) hostsample.obj: error LNK2019: unresolved external symbol __imp_timeGetTime referenced in function "struct ASIOTime * __cdecl bufferSwitchTimeInfo(struct ASIOTime *,long,long,class std::vector,class std::allocator > > >)" (?bufferSwitchTimeInfo@@YAPEAUASIOTime@@PEAU1@JJV?$vector@V?$vector@NV?$allocator@N@std@@@std@@V?$allocator@V?$vector@NV?$allocator@N@std@@@std@@@2@@std@@@Z) hostsample.obj: error LNK2019: unresolved external symbol "public: void __cdecl AsioDrivers::removeCurrentDriver(void)" (?removeCurrentDriver@AsioDrivers@@QEAAXXZ) referenced in function mexFunction hostsample.obj: error LNK2019: unresolved external symbol "bool __cdecl loadAsioDriver(char *) " (?loadAsioDriver@@YA_NPEAD@Z) referenced in function mexFunction hostsample.obj: error LNK2019: unresolved external symbol "struct ASIOTime * __cdecl bufferSwitchTimeInfo(struct ASIOTime *,long,long)" (?bufferSwitchTimeInfo@@YAPEAUASIOTime@@PEAU1@JJ@Z) referenced in function "void __cdecl bufferSwitch(long,long)" (?bufferSwitch@@YAXJJ@Z) hostsample.obj: error LNK2019: unresolved external symbol "class AsioDrivers * asioDrivers" (?asioDrivers@@3PEAVAsioDrivers@@EA) referenced in function mexFunction hostsample.mexw64: fatal error LNK1120: 19 unresolved externals

OK looks like I haven't included all the cpp and h files in the solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM