GLFW and Visual Studio Community 2015 - c++

I am new to C++ and want to include in my first project glfw.
I downloaded the 32-bit windows binaries from: http://www.glfw.org/download.html
I copied the include files and the lib files into my project folder. Then I added them in the project properties (additional include and library directories).
My dependencies look like this:
glfw3.lib opengl32.lib freeglut.lib glew32.lib glu32.lib
Additionally I copied the .dll file into .\System32
Now I get the following errors:
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwWindowShouldClose" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwWindowHint" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwTerminate" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwSwapBuffers" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwSetInputMode" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwPollEvents" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwMakeContextCurrent" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwInit" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwGetKey" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
> Fehler LNK2019 Verweis auf nicht aufgel÷stes externes Symbol
> "__imp__glfwCreateWindow" in Funktion
> "_main". BonbonGame F:\Programme\TestGame\TestGame\TestGame\TestGame.obj 1
As in the precompiled binaries only visual studio 2010-2013 libraries are included (I assume) I tried to compile it myself. I thought this could cause the errors.
I downloaded the files from "Source Package" . I used the CMake Gui to generate the build. I chose in the configuration "Visual Studio 14 2015" and generated the files. There werde some VC++ files created so I openened them in Visual Studio. I don't know what to do next. I have tried to run the project but I got the message: "Could not start ...\Debug\ALL_BUILD".

Try using VS 2013 instead. Also, please make sure to post English debugger info. I recommend switching to English all together, it makes finding solutions on the internet a lot easier and you'll be more respected as a programmer if you work in English entirely.

If you want to use vs2015 you could try to change toolset from v140 to v120 in project settings (Project->Properties->General->Platform Toolset).

They have already released dynamic and static libraries for v140 toolset. Get them from here: http://www.glfw.org/download.html

Related

Link dll against static build of QuaZip using Qt5.12 in VS2017

I'm trying to link a .dll against a static builld of QuaZip library to get rid of the quazip.dll dependency at runtine. Since I've ran into a dependency conflict at production because a customer is using other third party applications in the same process where my .dll is uncluded, which are also using the quazip.dll but a legacy version.
My steps were first to statically compile the zlib dependency as instructed in other posts with the ZLIB_WINAPI flag. Then I compiled QuaZip also with the appropriate ZLIB_WINAPI flag and QUAZIP_STATIC. As zlib.h I have used QtZlib/zlib.h header like in this post recommended. In my .dll project I've also tried to set all the mentioned flags (QUAZIP_STATIC seems to be necessary). Now when I try to compile my .dll I get the following errors
1>quazip.lib(zip.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__z_deflate#8" in Funktion "_zipCloseFileInZipRaw64#16".
1>quazip.lib(zip.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__z_deflateEnd#4" in Funktion "_zipCloseFileInZipRaw64#16".
1>quazip.lib(zip.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__z_crc32#12" in Funktion "_zipWriteInFileInZip#12".
1>quazip.lib(unzip.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp__z_crc32#12".
1>quazip.lib(zip.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_imp__z_deflateInit2#32" in Funktion "_zipOpenNewFileInZip4_64#76".
1>quazip.lib(zip.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__z_get_crc_table#0" in Funktion "_zipOpenNewFileInZip4_64#76".
1>quazip.lib(unzip.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "__imp__z_get_crc_table#0".
1>quazip.lib(unzip.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__z_inflate#8" in Funktion "_unzReadCurrentFile#12".
1>quazip.lib(unzip.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "__imp__z_inflateEnd#4" in Funktion "_unzCloseCurrentFile#4".
1>quazip.lib(unzip.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_imp__z_inflateInit2#16" in Funktion "_unzOpenCurrentFile3#20".
All projects have been build with the /MT flag.
This is my linker command line
/OUT:"builds\qt5\dll\release\.dll" /MANIFEST /NXCOMPAT /PDB:"builds\qt5\dll\release\.pdb" /DYNAMICBASE "qtmain.lib" "Qt5Core.lib" "Qt5Gui.lib" "Qt5Widgets.lib" "Qt5Sql.lib" "Qt5Network.lib" "Qt5PrintSupport.lib" "qwt.lib" "sloperatecppapi.lib" "slgfw.lib" "slgfwwidget.lib" "slcap.lib" "sltrc.lib" "sltrp.lib" "slhmiutilitieslib.lib" "slaesvcadapter.lib" "slfsfilesvcadapter.lib" "sltraceadapter.lib" "slarchiveadapter.lib" "slmd.lib" "slgfwmanager.lib" "slcncversioninfo.lib" "quazip.lib" "setupapi.lib" "wsock32.lib" "ws2_32.lib" "ucrt.lib" "vcruntime.lib" "msvcrt.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DLL /MACHINE:X86 /SAFESEH /INCREMENTAL:NO /PGD:"builds\qt5\dll\release<myapplication>.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"builds\qt5\dll\release<myapplication>.dll.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"S:\hmisl\lib" /LIBPATH:"S:\hmisl\siemens\sinumerik\hmi\osal\ace\lib" /LIBPATH:"S:\hmisl\siemens\sinumerik\hmi\osal\qt\lib" /LIBPATH:".\include\qt5\qwt\lib" /LIBPATH:".\include\qt5\quazip\lib" /LIBPATH:".\include\qt5\modbus\lib" /LIBPATH:".\include\qt5\qtsingleapplication\lib\release" /TLBID:1
I would be grateful for any new tip, because I've been trying this for almost a week now and I'm running out of ideas.
Ok, three days of agony and I have the solution. I recompiled the zlib, this time not using the provided project file in \contrib\vstudio\vc14, but generating my own with CMake. Then QuaZip linked against it with the flag QUAZIP_STATIC. I then set this flag in my project, which uses QuaZip and linked it against the built quazip.lib and its dependency zlibstatic.lib. Now the library is built into my .dll statically and I no longer have to supply the quazip.dll that caused the conflict.

Test program for software defined radio USRP X310

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.

linking openssl to visual studio 2013 LNK2019

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.

boost::asio ssl linking error

I'm using boost version 1.47, visual studio 2010, I downloaded the binaries for windows and linked to the include directory and lib directory from my project preferences. But I still can't use any ssl functionality from boost::asio.
This is the site where I downloaded the binaries: http://www.slproweb.com/products/Win32OpenSSL.html
I Downloaded: Visual C++ 2008 Redistributables and Win32 OpenSSL v1.0.1
These are the error messages I get:
Error 1 error LNK2019: unresolved external symbol _ERR_reason_error_string referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall boost::asio::error::detail::ssl_category::message(int)const " (?message#ssl_category#detail#error#asio#boost##UBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\main.obj OmniTcp
Error 2 error LNK2001: unresolved external symbol _ERR_reason_error_string C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\OmniTcp.obj OmniTcp
Error 3 error LNK2019: unresolved external symbol _CRYPTO_set_id_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ) C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\main.obj OmniTcp
Error 4 error LNK2001: unresolved external symbol _CRYPTO_set_id_callback C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\OmniTcp.obj OmniTcp
Error 5 error LNK2019: unresolved external symbol _CRYPTO_set_locking_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" (??0do_init#openssl_init_base#detail#ssl#asio#boost##QAE#XZ) C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\main.obj OmniTcp
Error 6 error LNK2001: unresolved external symbol _CRYPTO_set_locking_callback C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\OmniTcp\OmniTcp.obj OmniTcp
Error 25 error LNK1120: 12 unresolved externals C:\Documents and Settings\Elias\my documents\visual studio 2010\Projects\OmniTcp\Debug\OmniTcp.exe OmniTcp
I get a few more error messages but hey are all similar to eachother.
These are the libraries I linked to with boost 1.69, visual studio 2019, and OpenSSl-Win64:
libssl.lib;libcrypto.lib
As mentioned in the comments to the question, my project linked once I added:
lib\libeay32.lib
lib\ssleay32.lib
To the Project->Configuration Properties->Linker->Input->Additional Dependencies property.
Add the SSL dependencies (lib files) manually to project-->properties-->Linker-->Input-->Additional Dependencies.

Linking libcURL in Visual Studio 2008 Express

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.