I want to run the first test program for my software defined radio USRP X310 which is given on the company's website: https://kb.ettus.com/Getting_Started_with_UHD_and_C%2B%2B
I work with Visual Studio 2015 on Windows. I have installed, build and linked in VS2015 the boost and UHD libraries (UHD version 3.10.1.1 and boost version 1.63.0).
Trying to debug the program I get several error messages about 'unresolved external symbols'. I tried to locate the problem and ended up with very basic code example and noticed that the function 'uhd::usrp::multi_usrp::make(device_args)' does not work. In addition 'uhd::set_thread_priority_safe()' does not work either.
It seems to me that the code itself is not the problem. Does anyone know where these errors come from?
My code
#include <uhd/utils/safe_main.hpp>
`#include <uhd/usrp/multi_usrp.hpp>`
`#include <uhd/utils/thread_priority.hpp>`
`#include <csignal>`
`#include <iostream>`
int UHD_SAFE_MAIN(int argc, char *argv[]) {
uhd::set_thread_priority_safe();
std::string device_args("addr=192.168.10.2");
uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(device_args);
return 0;
}
Error messages (I am sorry that they are German. I translated them which is written in brackets):
Fehler (error) LNK2019 Verweis auf nicht aufgelöstes externes Symbol (link
to unresolved external symbol) ""__declspec(dllimport) public: __thiscall
uhd::device_addr_t::device_addr_t(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??
0device_addr_t#uhd##QAE#ABV?$basic_string#DU?$char_traits#D#std##V?
$allocator#D#2##std###Z)" in Funktion (in function) ""int __cdecl
_main(int,char * * const)" (?_main##YAHHQAPAD#Z)". line 1
Fehler (error) LNK2019 Verweis auf nicht aufgelöstes externes Symbol (link
to unresolved external symbol) ""__declspec(dllimport) public: __thiscall
uhd::device_addr_t::~device_addr_t(void)" (__imp_??
1device_addr_t#uhd##QAE#XZ)" in Funktion (in function) ""int __cdecl
_main(int,char * * const)" (?_main##YAHHQAPAD#Z)". line 1
Fehler (error) LNK2019 Verweis auf nicht aufgelöstes externes Symbol (link
to unresolved external symbol) ""__declspec(dllimport) public: static class
boost::shared_ptr<class uhd::usrp::multi_usrp> __cdecl
uhd::usrp::multi_usrp::make(class uhd::device_addr_t const &)" (__imp_?
make#multi_usrp#usrp#uhd##SA?AV?
$shared_ptr#Vmulti_usrp#usrp#uhd###boost##ABVdevice_addr_t#3##Z)" in
Funktion (in function) ""int __cdecl _main(int,char * * const)" (?
_main##YAHHQAPAD#Z)". line 1
Fehler (error) LNK2019 Verweis auf nicht aufgelöstes externes Symbol (link
to unresolved external symbol)""__declspec(dllimport) bool __cdecl
uhd::set_thread_priority_safe(float,bool)" (__imp_?
set_thread_priority_safe#uhd##YA_NM_N#Z)" in Funktion ""int __cdecl
_main(int,char * * const)" (?_main##YAHHQAPAD#Z)". line 1
LNK1120 4 nicht aufgelöste Externe (4 unresolved external symbols) line 1
this problem comes if you want to build it in Debug-Mode. The UHD you are linking to are build for Release-Mode, so you have to build your project in Release-Mode too. I had the same problem, and now i'm trying to build the UHD for VS2015 in Debug and Release mode, to be able to link in Debug-Mode, to the Debug-Objects and in Release-Mode to Release-Objects. But i don't get it build in Debug neither in Release-Mode with this TUT (https://kb.ettus.com/Building_and_Installing_the_USRP_Open_Source_Toolchain_(UHD_and_GNU_Radio)_on_Windows). I have to look for this. IF you will get it to work, it would be nice if you can tell how you have done it ( I'm german too).
Hope this helps you, even your post is 6 months old :D.
Related
I'm trying to use Boost.Asio on a ActiveX DLL project using Visual Studio 2013.
Not sure what is wrong but when building these error shows up:
Error 34 error LNK2019: unresolved external symbol "class
boost::system::error_category const & __cdecl
boost::system::system_category(void)"
(?system_category#system#boost##YAABVerror_category#12#XZ) referenced
in function "public: __thiscall
boost::system::error_code::error_code(void)"
(??0error_code#system#boost##QAE#XZ) C:\eCompany\activex-dll\maindoor\RESTClient.obj maindoor
Error 35 error LNK2019: unresolved external symbol "class
boost::system::error_category const & __cdecl
boost::system::generic_category(void)"
(?generic_category#system#boost##YAABVerror_category#12#XZ) referenced
in function "void __cdecl boost::system::`dynamic initializer for
'errno_ecat''(void)"
(??__Eerrno_ecat#system#boost##YAXXZ) C:\Projects\eCompany\activex-dll\maindoor\RESTClient.obj maindoor
Error 36 error LNK1120: 2 unresolved
externals C:\Projects\eCompany\activex-dll\maindoor\Debug\maindoorEWI.dll 1 1 maindoor
I already added BOOST_ALL_NO_LIB in the Preprocessor. What could be missing in the project?
The short answer is to do something like this:
C:\local\boost_1_58_0>bjam.exe runtime-link=static
and remove BOOST_ALL_NO_LIB is its set, then build the DLL again. That should fix that.
I'm developing on a visual studio 2013 application and therefore I need to include openssl libraries.
What have I done so far:
I downloaded the precompiled openssl libraries for VS2013 openssl-1.0.1l-vs2013.7z from here: http://www.npcglib.org/~stathis/blog/precompiled-openssl/ (newest stable entry MSVC2013)
included openssl's include dir to C/C++/General/Additional Include Directories
added lib64/libeay32MTd.lib and lib64/ssleay32MTd.lib to Linker/Input/Additional Dependencies
I call openssl headers this way: #include <openssl\pem.h> (as example)
I am using VS 2013 on a 64 Bit Windows maschine with the multithreading runtime library (/MTd). Every time I want to build my project it gives me the following errors:
error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_BIO_new_mem_buf" in Funktion "__catch$?decrypt#cipherEngine##QAE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PADH#Z$4".
error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_RSA_private_decrypt" in Funktion "__catch$?decrypt#cipherEngine##QAE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PADH#Z$4".
error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_PEM_read_bio_RSAPrivateKey" in Funktion "__catch$?decrypt#cipherEngine##QAE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PADH#Z$4".
error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: class std::basic_string,class std::allocator > __thiscall cipherEngine::rsaPrivateDecrypt(class std::basic_string,class std::allocator >)" (?rsaPrivateDecrypt#cipherEngine##QAE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##V23##Z)" in Funktion ""public: bool __thiscall cipherEngine::alterKey(class std::basic_string,class std::allocator >)" (?alterKey#cipherEngine##QAE_NV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)".
fatal error LNK1120: 4 nicht aufgelöste Externe
Anyone who knows the "missing link"?
When adding external libraries to VS I usually try to include the library source and build them within my own tree. This avoids the problem I think you are seeing, which is that the precompiled library has been compiled with slightly different options than your main project. The different options render the library unusable to you.
If you really don't want to compile the lib within your project, try investigating those symbols further to identify the compile variant.
I forgot to define the class, the function rsaPrivateDecrypt belongs to (shame on me). The second thing was to use the 32Bit libs instead of the 64Bit libs.
I just bought a new laptop with windows 8 64bit and I am using Visual Studio 2012.
I did the usual procedure with installing a 3d party lib just as I installed them on my previous PCs:
Download freeglut, glew, glfw, glut, sdl
Copy headers into "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include"
Copy libs into "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib"
Copy dll's into "C:\Windows\SysWOW64"
Then I downloaded the project I was developing on my other PC (was developed under windows 8 32bit if that's of any importance) and it would'n compile. The compiler threw me the following linking error:
Error 1 error LNK2001: unresolved external symbol __imp__glDrawArrays#12 - about 50 of these
Error 63 error LNK2019: unresolved external symbol __imp__glClear#4 - again about 50 of these
The project is working perfectly on my old PC.
I did try to make a simple new project: http://pastebin.com/GfEieL6f
Linked the following libraries (Properties->Linker->Input->Additional Dependencies)
opengl32.lib
glut32.lib
glu32.lib
And again it wouldn't compile, again the same linking errors:
Error 1 error LNK2019: unresolved external symbol __imp__glBegin#4 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 2 error LNK2019: unresolved external symbol __imp__glClear#4 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 3 error LNK2019: unresolved external symbol __imp__glClearColor#16 referenced in function _main P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 4 error LNK2019: unresolved external symbol __imp__glColor3f#12 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 5 error LNK2019: unresolved external symbol __imp__glEnd#0 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 6 error LNK2019: unresolved external symbol __imp__glFlush#0 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 7 error LNK2019: unresolved external symbol __imp__glLoadIdentity#0 referenced in function _main P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 8 error LNK2019: unresolved external symbol __imp__glMatrixMode#4 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 9 error LNK2019: unresolved external symbol __imp__glOrtho#48 referenced in function _main P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 10 error LNK2019: unresolved external symbol __imp__glRotatef#16 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
Error 11 error LNK2019: unresolved external symbol __imp__glVertex3iv#4 referenced in function "void __cdecl drawcube(void)" (?drawcube##YAXXZ) P:\OpenGL_Setup\OpenGL_Setup\opengl_setup.obj
I don't know if I am missing something, can you give me some ideas ?
PP: I managed to fix the simple program and run it, but I cannot run my old project. Maybe it's a problem because of the platform change ? How can I fix it?
Don't add files to the compiler lib directory. Instead add another library search path to your project.
You probably downloaded library files that aren't compatible with VC++ 2012 and your project build settings. In native code, you can't mix x86, x64, etc. Static libraries need to match your project bitness, not your OS. And Microsoft also changes/extends the library file format, as well as runtime library components used by the library, so you really should get a library file designed for your version of VC++.
Mfc application is showing following error when buil in release mode
Error 152 error LNK2019: unresolved external symbol SHGetPathFromIDList referenced in function "public: class ATL::CStringT > > __cdecl CCopyFile::DoBrowse(void)" (?DoBrowse#CCopyFile##QAA?AV?$CStringT#_WV?$StrTraitMFC#_WV?$ChTraitsOS#_W#ATL#####ATL##XZ) CopyFile.obj
Error 153 error LNK2001: unresolved external symbol SHGetPathFromIDList IflawFileDialog.obj
Error 154 error LNK2001: unresolved external symbol SHGetPathFromIDList NewFile.obj
Error 155 error LNK2019: unresolved external symbol SHBrowseForFolder referenced in function "public: class ATL::CStringT > > __cdecl CCopyFile::DoBrowse(void)" (?DoBrowse#CCopyFile##QAA?AV?$CStringT#_WV?$StrTraitMFC#_WV?$ChTraitsOS#_W#ATL#####ATL##XZ) CopyFile.obj
Compare the debug/release linker input dependencies for your project. The release one is probably missing shell32.lib
my first question here:
I am having trouble using libcURL in a c++ project. I don't even get it linked. I am using Windows XP and Visual C++ 2008 Express Edition.
So here is what I did:
Downloaded libcURL: curl-7.19.5-devel-mingw32.zip
Opened new commandline project in VC++
Include folders 'lib' and 'include' to my new project (maybe trivial but took me a while ;-)
in Properties->C/C++->General: Added folder 'include' to 'additional folders to include'
in Properties->Linker->General: Added folder 'lib' to 'additional folders with libraries'
in Properties->Linker->Input: Added additional dependencies: libcurl.a libcrypto.a libeay32.a libidn.a libssh2.a libssh2dll.a libssl32.a libssl.a libz.a libzdll.a ws2_32.lib wldap32.lib
in Properties->C/C++->Preprocessor: Added definition 'CURL_STATICLIB'
I unchecked 'Precompiled Headers' and made sure 'Multithreaded-DLL (/MD)' is used
Now I copied the example simple.c (from http://curl.haxx.se/lxr/source/docs/examples/simple.c) into my main project file. When I try to compile I get the following output:
Neues Erstellen gestartet: Projekt: curl_project, Konfiguration: Debug Win32
Die Zwischen- und Ausgabedateien für das Projekt "curl_project" mit der Konfiguration "Debug|Win32" werden gelöscht.
Kompilieren...
stdafx.cpp
Kompilieren...
curl_project.cpp
Manifest in Ressourcen wird kompiliert...
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
Copyright (C) Microsoft Corporation. All rights reserved.
Verknüpfen...
libcurl.a(ftp.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(file.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_strtoll" in Funktion "_file_do".
libcurl.a(cookie.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(transfer.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(ssh.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(http.o) : error LNK2001: Nicht aufgelöstes externes Symbol "_strtoll".
libcurl.a(mprintf.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "___umoddi3" in Funktion "_dprintf_formatf".
libcrypto.a(b_print.o) : error LNK2001: Nicht aufgelöstes externes Symbol "___umoddi3".
libcrypto.a(bn_word.o) : error LNK2001: Nicht aufgelöstes externes Symbol "___umoddi3".
libcurl.a(mprintf.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "___udivdi3" in Funktion "_dprintf_formatf".
libcrypto.a(b_print.o) : error LNK2001: Nicht aufgelöstes externes Symbol "___udivdi3".
libcrypto.a(e_atalla.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcrypto.a(eng_padlock.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__alloca" in Funktion "_ENGINE_load_padlock".
libcrypto.a(sha512.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcrypto.a(bn_prime.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcurl.a(mprintf.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcurl.a(formdata.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcrypto.a(err_prn.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcrypto.a(cryptlib.o) : error LNK2001: Nicht aufgelöstes externes Symbol "__alloca".
libcurl.a(progress.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "___divdi3" in Funktion "_time2str".
libssh2.a(scp.o) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_snprintf" in Funktion "_libssh2_scp_send_ex".
C:\Dokumente und Einstellungen\Punkx\Eigene Dateien\Visual Studio 2008\Projects\curl_project\Debug\curl_project.exe : fatal error LNK1120: 6 nicht aufgelöste externe Verweise.
Das Buildprotokoll wurde unter "file://c:\Dokumente und Einstellungen\Punkx\Eigene Dateien\Visual Studio 2008\Projects\curl_project\curl_project\Debug\BuildLog.htm" gespeichert.
curl_project - 22 Fehler, 0 Warnung(en)
========== Alles neu erstellen: 0 erfolgreich, Fehler bei 1, 0 übersprungen ==========
Can someone see, what I have forgotten or where the problem is? I am a C++ Beginner, so it could be something trival...
Thx for the help!
You're using MinGW libraries with the Visual C++ compiler. Use the correct binary package and/or build it yourself.
If you're using Visual C++, you shouldn't be dealing with .a files but only with .lib.