I'm using Visual studio 2019
I followed this link to install wxWidget using vcpkg install wxwidgets
https://www.wxwidgets.org/blog/2019/01/wxwidgets-and-vcpkg/
and read this link
https://computingonplains.wordpress.com/using-visual-studio-2017-to-build-wxwidgets/
and this
https://devblogs.microsoft.com/cppblog/vcpkg-updates-static-linking-is-now-available/
the problem after installing wxWidget using vcpkg the result build is Dynamic library and I want to compile my project as static library to run exe file on other users pc .
I want to change from Dynamic lib compilation to static due to :
users on another PCs get VCRUNTIME error so they have to install VC++ runtime library as I read in
How to fix a missing vcruntime140 clr 400 dll error
Summary of the problem :
vcpkg installation wxwidgets result is dynamic lib configuration and I need to install static one .
Instead of just doing vcpkg install wxwidgets
use vcpkg install wxwidgets:x64-windows-static
This will install wxwidgets and all it dependencies with static runtime and library linkage.
You can also define your custom triplet if you want to customize your build setup (see https://github.com/microsoft/vcpkg/blob/master/docs/users/triplets.md)
#MohmmedAlaa,
You are better off compiling the library yourself.
There is a big difference between compiling the project with wxWidgets being dynamic vs static and VC++ RT dynamic vs static.
Also, keep in mind that some VC++ RT is not licensed to be distributable.
So all in all - get the wxWidgets sources, install MSVC, build static libraries (possibly with the compiler switch to use "static RT) and compile your software.
Related
I am using abseil-cpp in my C++ project built under Visual Studio 2019 / Windows 10.
Using CMake (not Visual Studio built-in makefile support) and following the static binaries instructions I have built a set of libraries and header files which I can then successfully link into a standard Visual Studio solution.
The issue I have is that the library builds with a build type of Debug, which means that I cannot link them into a Release build of my application.
What I need is to build a Release version of the abseil-cpp libraries. However the for the life of me I cannot figure out how to coax CMake / Abseil build process to do this!
I have tried the following, all of which are either ignored or error:
Add set(CMAKE_BUILD_TYPE Release) to the CMakeLists.txt file in the root of the abseil-cpp source tree
Add -DCMAKE_BUILD_TYPE=Release to the cmake .. -DCMAKE_INSTALL_PREFIX=~/Source/CMakeProject/install step given in the instructions
Add -DCMAKE_BUILD_TYPE=Release to the cmake --build . --target install step given in the instructions
Can anyone suggest what I need to do to build a Release version of static binary libraries?
Ian
I am trying to build boost 1.70 with ICU support. For this, I built ICU (version 61.1) some time ago. In our internal system, I have this sort of directory structure for ICU and I cannot change it quickly because several components using this library and expecting the libraries from this directory structure:
...\icu\lib (for x86 version of lib files)
...\icu\bin (for x86 version of dll files)
...\icu\lib64 (for x64 version of lib files)
...\icu\bin64 (for x64 version of dll files)
...\icu\include (include headers files for icu)
So, after building ICU, I put the files into their respective directory.
Now I want to build boost 1.70 with ICU support, so I used this build command in a self written batch script (here, 32bit as an example):
set "PATH_TO_ICU=.....\icu"
...
if not exist "%PATH_TO_ICU%" (
echo "Error: Could not find path to icu. Was looking in '%PATH_TO_ICU%'"
pause
exit /b 1
)
...
:: debug 32bit / static
b2 --build-type=complete toolset=msvc-14.1 variant=debug threading=multi link=static -sICU_PATH="%PATH_TO_ICU%" -sICU_LINK="%PATH_TO_ICU%\lib" include="%PATH_TO_ICU%\include"
But the output during build is showing me this
- has_icu builds : no
...
- icu : no
- icu (lib64) : no
Additional Information: I am building this with Visual Studio 2017.
So, what I am missing here?
Edit
I looked into the file boost_root\bin.v2\config.log and saw this sort of lines
Line 132: LINK : fatal error LNK1181: cannot open input file '....\icu\lib.obj'
which maybe explains why b2 could not see ICU correctly.
For windows, I would investigate Microsoft VCPKG. I used to build Boost from scratch with both zlib and bzip2 support but I have found that vcpkg is far easier. You don't need to keep vcpkg around either. After building boost or any of the other 3rd party libraries, export boost (using the vcpkg export command) and you'll have copy that you can use most anywhere. Vcpkg can build 32 or 64 bit packages and static and shared. I actually adjust the vcpkg triplets to generate a static library that links against the shared crt so I don't worry about DLL's. The point is that vcpkg can handle all of your needs. In fact for boost, you can build just the components you want if you so desire.
Can you help me with the steps to link/import Crypto++ library to OMNeT++ framework properly, please.
I use OMNeT++ 5.0/inetmanet 3.0 version (Windows 10).
OMNeT++ on windows is a C++ simulation library that is built in MinGW environment with GCC (on windows). As such, everything that applies to a general program applies here. You need to have the crypto++ headers in the /tools/win32/mingw32/include folder, the libraries in the tools/win32/mingw32/lib and the dll in the bin directory...
You may be able to install the library and the headers with:
pacman -Su mingw-w64-i686-crypto++
After that you can just use the include file of the library as usual. You have to add the crypto library to the linker command line (in the IDE: Project / Properties and add the library in the "Makemake" dialog on the Libraries tab.
I am currently attempting to transition a CMake project from Linux to Windows that is dependent on OpenCV, but I'm having trouble linking the libraries to the executable.
I've posted the approximate CMakeLists.txt file below with some private stuff left out:
project(my_project_name)
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_CXX_FLAGS "-g -Wall")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
FIND_PACKAGE(OpenCV REQUIRED)
IF(NOT OpenCV_FOUND)
MESSAGE(FATAL_ERROR "OpenCV not found")
ENDIF()
SET(PROJECT_HDRS
#headers here
)
SET(PROJECT_SRCS
#sources here
)
add_executable(${PROJECT_NAME} ${PROJECT_SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS})
This CMakeLists.txt file works just fine on Linux, but has trouble linking on Windows. My first instinct was that it was a bad install of OpenCV? Here are the approximate steps I used while installing OpenCV
Download OpenCV 2.4.3 executable (a self-extracting archive)
Extract to some directory
Use CMake-Gui to configure and generate OpenCV.sln
Open in Visual Studio C++ 2010 Express and build the ALL_BUILD project in Debug and Release configurations
Build the INSTALL project
When I try to build my own project, I get back the errors "undefined reference to 'cv::waitKey(int)' errors, which makes me think that it's a linker issue. I've attempted pointing to the .lib files directly, such as:
target_link_libraries(${PROJECT_NAME} C:/someDirectory/opencv_core243.lib)
but I still get back the same errors.
I've also attempted the methods in described in these StackOverflow threads:
here and here.
I apologize beforehand if I'm missing something obvious, but this is more or less the first time I've developed on windows and I'm running out of ideas.
to my knowledge the problem is that visual studio2010 or vc++2010 comes with .net framework 4.5
Downgrade it to .net framework4 (i.e. uninstall .net 4.5 and install 4.0).
That would solve the problem...
I hit my head to my table solving the above problem..
or else
patch the visual c++ with new Service pack
it´s a little bit late but... let´s go
for me this tutorial was perfect
http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/
I'm working on a DLL project in VS 2010, I want to use boost mutex in some part of my code. but when I compile project to release final DLL, I get this linkage error:
LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc100-mt-1_49.lib'
I've already compiled boost with this command:
bjam install --toolset=msvc variant=release link=static threading=multi runtime-link=static
& I've a file named libboost_date_time-vc100-mt-s-1_49.lib, when I change configuration type of my project from Dynamic Linked Library (DLL) to Static Library, the project builds successfully, but I need to release only as a DLL file (& my final DLL CAN NOT have any dependency to other external DLLs). I know the problem causes by compilation of boost, but I don't know how should I recompile it
Any guideline?
Check that you link the runtime-library statically (Configuration properties-->C/C++-->Code generation-->Runtime library: Multi-threaded (/MT).
Otherwise, link CRT and boost dynamically. For this purpose build boost like this:
bjam --toolset=msvc variant=release link=shared threading=multi runtime-link=shared
IMO, you built the boost library just fine : you used link=static which means you would like to emit static library (and not a DLL) and since you would like to have standalone deployment , you specified runtime-link=static meaning you link against MS C/C++ run time as static libraries (e.g. the code for printf() will be embedded in your final library and not be referenced to msvcr100.dll)
Please take a look at the picture below, make sure to set the full path of the directory where your boost library resides under Additional Library Dependencies
I fixed my error "Error LNK1104 cannot open file 'libboost_locale-vc142-mt-gd-x32-1_73.lib'" in a DLL project, which I described in this issue on boost' github by installing the boost library using vcpkg.
Install vcpkg. Then write .\vcpkg install boost. You can see how it's done in the video: https://youtu.be/b7SdgK7Y510 . He's not installing the boost library but the process is exactly the same.
This is all for Windows and Visual Studio's toolset, of course.