Hi everyone, im trying to use the C++ libraries for OptoMMP on visual studio express 2013. I tried to follow the instructions on page 64 and 66 on the optoMMP manual but i cant find the exe file to install it inside the download I got at opto22 website: http://www.opto22.com/site/downloads/dl_drilldown.aspx?aid=4420
The name of the file missing is : SnapENETDTK_R20a.exe (i guess the version will differ)
Therefore I tried to link the library manually but Im getting a ton of linking errors. (added them at the end)
Here is what I did to manually link the library:
Add #include statements necessary files with declarations/interfaces, e.g.: #include"library.h"2) Add an include directory for the compiler to look into
-> Configuration Properties/VC++ Directories/Include Directories (click and edit, add a new entry)
Add a library directory for *.lib files, I think I did it wrong since the only .lib i can find is inside the output file of the dev kit download called OptoMMPToolkit-Debug.lib
-> Configuration Properties/VC++ Directories/Library Directories (click and edit, add a new entry)
Link the lib’s *.lib files
-> Configuration Properties/Linker/Input/Additional Dependencies (e.g.: library.lib;
Place *.dll files either:
I couldnt find any dll files at the dev kit download.
Thank you very much for the help!
Here is the errors im getting :
Warning 1 warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 14 error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "protected: int __thiscall O22SnapIoMemMap::OpenSockets(char *,int,int)" (?OpenSockets@O22SnapIoMemMap@@IAEHPADHH@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 16 error LNK2019: unresolved external symbol __imp__WSAGetLastError@0 referenced in function "protected: int __thiscall O22SnapIoMemMap::CloseSockets(void)" (?CloseSockets@O22SnapIoMemMap@@IAEHXZ) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 15 error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function "public: __thiscall O22SnapIoMemMap::~O22SnapIoMemMap(void)" (??1O22SnapIoMemMap@@QAE@XZ) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 12 error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "protected: int __thiscall O22SnapIoMemMap::OpenSockets(char *,int,int)" (?OpenSockets@O22SnapIoMemMap@@IAEHPADHH@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 11 error LNK2019: unresolved external symbol __imp__send@16 referenced in function "private: int __thiscall O22SnapIoMemMap::ReadBlockEthernet(unsigned int,unsigned short,unsigned char *)" (?ReadBlockEthernet@O22SnapIoMemMap@@AAEHIGPAE@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 10 error LNK2019: unresolved external symbol __imp__select@20 referenced in function "public: int __thiscall O22SnapIoMemMap::IsOpenDone(void)" (?IsOpenDone@O22SnapIoMemMap@@QAEHXZ) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-
Debug.lib(O22SIOMM.obj) optoTest
Error 9 error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "private: int __thiscall O22SnapIoMemMap::ReadBlockEthernet(unsigned int,unsigned short,unsigned char *)" (?ReadBlockEthernet@O22SnapIoMemMap@@AAEHIGPAE@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 8 error LNK2019: unresolved external symbol __imp__ntohs@4 referenced in function "private: int __thiscall O22SnapIoMemMap::ReadBlockSerial(unsigned int,unsigned short,unsigned char *)" (?ReadBlockSerial@O22SnapIoMemMap@@AAEHIGPAE@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 4 error LNK2019: unresolved external symbol __imp__ioctlsocket@12 referenced in function "protected: int __thiscall O22SnapIoMemMap::OpenSockets(char *,int,int)" (?OpenSockets@O22SnapIoMemMap@@IAEHPADHH@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 7 error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function "protected: int __thiscall O22SnapIoMemMap::OpenSockets(char *,int,int)" (?OpenSockets@O22SnapIoMemMap@@IAEHPADHH@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 6 error LNK2019: unresolved external symbol __imp__htons@4 referenced in function "protected: int __thiscall O22SnapIoMemMap::OpenSockets(char *,int,int)" (?OpenSockets@O22SnapIoMemMap@@IAEHPADHH@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 5 error LNK2019: unresolved external symbol __imp__htonl@4 referenced in function "private: int __thiscall O22SnapIoMemMap::ReadBlockPassThru(unsigned int,unsigned short,unsigned char *)" (?ReadBlockPassThru@O22SnapIoMemMap@@AAEHIGPAE@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 13 error LNK2019: unresolved external symbol __imp__gethostbyname@4 referenced in function "protected: int __thiscall O22SnapIoMemMap::OpenSockets(char *,int,int)" (?OpenSockets@O22SnapIoMemMap@@IAEHPADHH@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 3 error LNK2019: unresolved external symbol __imp__connect@12 referenced in function "protected: int __thiscall O22SnapIoMemMap::OpenSockets(char *,int,int)" (?OpenSockets@O22SnapIoMemMap@@IAEHPADHH@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 2 error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "protected: int __thiscall O22SnapIoMemMap::CloseSockets(void)" (?CloseSockets@O22SnapIoMemMap@@IAEHXZ) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\optoTest\OptoMMPToolkit-Debug.lib(O22SIOMM.obj) optoTest
Error 17 error LNK1120: 15 unresolved externals C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest\Debug\optoTest.exe optoTest
I guess writing this question made me find the first error I was doing, I found the file SnapENETDTK_R20a.exe on the OptoMMP Communication Toolkit on opto22.com I installed that and followed the instructions on page 66 to add the reference to visual studio (these are instruction for visual basic but it allowed me to add it the same way in C++).
Finally I added the C++ OptoMMP Software Development Kit files to the project by doing this:
Add #include “O22SIOMM.h”
Add an include directory for the compiler to look into
-> Configuration Properties/VC++ Directories/Include Directories (I added the source directory of the c++ optommp soft dev kit)
This allowed me to make an instance of objects from the optoMMP library but when I build the project I get a new set of errors related to linking now the 2028 error instead the 2019:
Error 7 error LNK2028: unresolved token (0A00003A) "public: int __thiscall O22SnapIoMemMap::Close(void)" (?Close@O22SnapIoMemMap@@$$FQAEHXZ) referenced in function "void __cdecl cleanUp(class O22SnapIoMemMap *)" (?cleanUp@@$$FYAXPAVO22SnapIoMemMap@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 6 error LNK2028: unresolved token (0A000038) "public: int __thiscall O22SnapIoMemMap::SetDigPtState(int,int)" (?SetDigPtState@O22SnapIoMemMap@@$$FQAEHHH@Z) referenced in function "void __cdecl `anonymous namespace'::SetDigitalPointState(class O22SnapIoMemMap &,int,int,char const *)" (?SetDigitalPointState@?A0x5a1bb5f3@@$$FYAXAAVO22SnapIoMemMap@@HHPBD@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 5 error LNK2028: unresolved token (0A000035) "public: __thiscall O22SnapIoMemMap::O22SnapIoMemMap(void)" (??0O22SnapIoMemMap@@$$FQAE@XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 4 error LNK2028: unresolved token (0A000034) "public: __thiscall O22SnapIoMemMap::~O22SnapIoMemMap(void)" (??1O22SnapIoMemMap@@$$FQAE@XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 3 error LNK2028: unresolved token (0A000031) "public: int __thiscall O22SnapIoMemMap::OpenEnet2(char *,int,int,int,int)" (?OpenEnet2@O22SnapIoMemMap@@$$FQAEHPADHHHH@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj
optoTest2
Error 2 error LNK2028: unresolved token (0A00002F) "public: int __thiscall O22SnapIoMemMap::IsOpenDone(void)" (?IsOpenDone@O22SnapIoMemMap@@$$FQAEHXZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 1 error LNK2028: unresolved token (0A00002E) "public: int __thiscall O22SnapIoMemMap::ConfigurePoint(int,int)" (?ConfigurePoint@O22SnapIoMemMap@@$$FQAEHHH@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 9 error LNK2019: unresolved external symbol "public: int __thiscall O22SnapIoMemMap::SetDigPtState(int,int)" (?SetDigPtState@O22SnapIoMemMap@@$$FQAEHHH@Z) referenced in function "void __cdecl `anonymous namespace'::SetDigitalPointState(class O22SnapIoMemMap &,int,int,char const *)" (?SetDigitalPointState@?A0x5a1bb5f3@@$$FYAXAAVO22SnapIoMemMap@@HHPBD@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 11 error LNK2019: unresolved external symbol "public: int __thiscall O22SnapIoMemMap::OpenEnet2(char *,int,int,int,int)" (?OpenEnet2@O22SnapIoMemMap@@$$FQAEHPADHHHH@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 12 error LNK2019: unresolved external symbol "public: int __thiscall O22SnapIoMemMap::IsOpenDone(void)" (?IsOpenDone@O22SnapIoMemMap@@$$FQAEHXZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 13 error LNK2019: unresolved external symbol "public: int __thiscall O22SnapIoMemMap::ConfigurePoint(int,int)" (?ConfigurePoint@O22SnapIoMemMap@@$$FQAEHHH@Z) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 8 error LNK2019: unresolved external symbol "public: int __thiscall O22SnapIoMemMap::Close(void)" (?Close@O22SnapIoMemMap@@$$FQAEHXZ) referenced in function "void __cdecl cleanUp(class O22SnapIoMemMap *)" (?cleanUp@@$$FYAXPAVO22SnapIoMemMap@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 10 error LNK2019: unresolved external symbol "public: __thiscall O22SnapIoMemMap::O22SnapIoMemMap(void)" (??0O22SnapIoMemMap@@$$FQAE@XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 14 error LNK2019: unresolved external symbol "public: __thiscall O22SnapIoMemMap::~O22SnapIoMemMap(void)" (??1O22SnapIoMemMap@@$$FQAE@XZ) referenced in function "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\optoTest2\optoTest2.obj optoTest2
Error 15 error LNK1120: 14 unresolved externals C:\Dropbox (Perez Larios)\AutomaticInspection\Pruebas\optoPruebas\optoTest2\Debug\optoTest2.exe optoTest2
I would like to use C++ to communicate with Opto22.
But, I cannot even make cpp, vba, samples from the kit to work.
Could anyone post simplest working C++ code to read and write to scratch-pad?