Linker Errors in Windows 10
I need to write a Tango Server in C++, that has to run on a Windows machine. Installation and testing worked just fine, I could start the host and the test device server, all the tools like Astor, Jive and Pogo are fully operational.
Now I wanted to go the next step and compile a server by my own. However, if I hit compile, the following errors occur:
LNK2019 unsolved external symbol <…> referenced in function <…>
In total there are 11 of there errors, I put a screenshot of these errors in the attachments.
I am quite confused about that, I thought by including tango.h all the linking should be solved.
System: Windows 10 x64
Compiler: Visual Studio 2017
Tango Version: 9.3.4 (9.2.2)
I am open to any suggestions of solving that problem, like change to version x or to use compiler y or ticking checkbox z.
Thank you for your help.
Tango 9.3.4 has some problems with Windows compilation.
Please try tango 9.3.5 which has (most) of them solved. See https://ci.appveyor.com/project/bourtemb/cpptango-nh0mp/builds/43239681 for the binaries. The static builds (tango as static library) work, the dynamic build still is not working. You are probably missing some compiler flags, see https://gitlab.com/tango-controls/cppTango/-/issues/921 for that worked locally here.
Hope that helps,
PS: In the future please prefer posting error messages as text directly in the topic instead of attaching a screenshot.
I still need some more help.
Following your advice, I downloaded Tango 9.3.5. Without any tweaking, I included the new tango.h file to my project. That led to around 1100 errors of type "expression not found" and some others, in which hole files like "omniORB4/omniInterceptors.h" were not found.
Then I tried to follow the instructions of correctly using cmake, however I got this error:
D:\tango_root\tango_9_3_5>cmake -B build-shared -S . -G "Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS_RELEASE="/MD" -DCMAKE_CXX_FLAGS_DEBUG="/MDd" -DIDL_BASE="%BASE_FOLDER%\\tango-idl" -DOMNI_BASE="%BASE_FOLDER%\\omniorb" -DZMQ_BASE="%BASE_FOLDER%\\zeromq-4.0.5-2" -DCPPZMQ_BASE="%BASE_FOLDER%\\zeromq-4.0.5-2" -DPTHREAD_WIN="%BASE_FOLDER%\\pthreads-win32" -DTANGO_INSTALL_DEPENDENCIES=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON
– Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19044.
– The C compiler identification is MSVC 19.16.27045.0
– The CXX compiler identification is MSVC 19.16.27045.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
selected dynamic-library build
– Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
– Looking for C++ include zmq.hpp
– Looking for C++ include zmq.hpp - not found
CMake Error at configure/CMakeLists.txt:148 (message):
zmq.hpp include file not found.
And then it gave me a link from where I could download that file. However, I got the feeling that do something more fundamentally wrong. Is it the right way to go to just download the latest binaries and include them to my project? They seem incomplete compared to all the files one can get from the Tango home page (I know that these binaries are just the c++ part of Tango, but still).
In a nutshell: Is my thinking of installation flawed, or do I actually have to install additional packages into tango for as long as cmake tells me to?
> They seem incomplete compared to all the files one can get from the Tango home page (I know that these binaries are just the c++ part of Tango, but still).
Which downloads are you referring to?
The appveyor link I posted earlier has ready made tango binaries for Windows, so I don't think it is required to compile it yourself.
Regrading the cmake error, I would try to get rid of the duplicated backslashes in the in XXX_BASE paths and try again.
I was referring to the most obvious place one would search for a Tango Controls download:
Looking again at all the possible downloads I could find within your links, I am even more confused.
Downloading the files from AppVeyor yields me the classical structure with the folders "bin", "include" and "lib". Depending on using the .zip archive or the installer, these folders are more or less densely populated (using the installer, I got much fewer files, not even a tango.h file). In this method, a zmq.hpp file is included. However, these folders are free of cmake files. So just using the referenced commands will not work at all.
If I then take a look at the files in github (there the packing via cmake was referenced), I get a different set of files. At first, the structure is totally different (no include folder, tango.h hides in "cppapi/server") but more importantly, this repo has cmake files and even make files (great if I were allowed to use linux). However, no zmq.hpp file or hint of that can be found.
That's why I doubt that changing the cmake command will have any effect. The files are truly missing.