Trouble building Boost Libraries - boost

OS: Win7
IDE: Visual Studio 2010 Professional
Boost Lib Version: 1.47
Downloaded "boost_1_47_setup.exe" installer from http://www.boostpro.com/download/
Initially installed everything for VS 10, then just checked every box (5+ GB install!)
Added the "boost\boost_1_47" path into "Additional Include Directories" in C++->General
Copy/Pasted code from "Getting Started on Windows: 4 - Build a Simple Program Using Boost"
Compiled without issue
Included boost/regex.hpp and re-compiled
Received Error:
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-gd-1_47.lib'
Expected, haven't built the binaries yet.
Ran "Visual Studio Command Prompt" from tools folder in my VS 10 installation as admin
cd'ed to boost root
Ran bootstrap.bat from command line
Received Error:
Building Boost.Build engine
The system cannot find the path specified.
'.\build.bat' is not recognized as an internal or external command,
operable program or batch file.
Failed to build Boost.Build engine.
Please consult bootstrap.log for furter diagnostics.
Everything I did came from the Getting Started page on Boost.org. Not sure if its just dated or if I'm doing something wrong.
Came here looking for answers, found some similar issues, namely the following:
Problem with C++ Boost installation (can't find file) in VC++ 2010
Problem with C++ Boost installation (can't find file) in VC++ 2010
Boost C++ Libraries linker error libboost_serialization-vc100-mt-gd-1_47.lib
Boost C++ Libraries linker error libboost_serialization-vc100-mt-gd-1_47.lib
No dice. Any help would be appreciated. Thanks

The compiler cannot find the BOOST's library file. To fix the issue you have to find on your computer the libboost_regex-vc100-mt-gd-1_47.lib file and add its folder path to the Project->YourProjectName Properties (Alt+F7)->Configuration Properties->Linker->General->Additional Library Directories. After recompile your project.

This is the answer to the above comment of #Johnny 5....thousand. In VS10 the compiler-wide additional libraries are deprecated. I solved the problem by adding a new project property sheet to all my projects. It is possible to do it by calling the Property Manager Tab (View->Property Manager). In the Property Manager Tab is necessary to click right mouse button on the project, select Add New Project Property Sheet, Save the sheet to a well-known place. After to define a new User Macro - Name:BOOST, Value: Your Boost Path, for example c:\boost_1_47_0\, also add the $(BOOST) to the Additional Include Directories and ad the $(BOOST)\lib to the Additional Library Directories. That's all. For all other projects is required to add existing property sheet.

Related

LNK1104 error with example CMake project in Visual Studio 2017

I decided to give the built-in CMake support in VS2017 a try, and instead of figuring out why our multi-library, multi-executable project has problems with find_package in the hand-crafted CMakeLists.txt files that it has used for years, I decided to try a simple project first, the FooBar example from the CMake wiki: https://cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file
This project creates a shared library foo and an executable bar that links to this library, and is about as simple as they come. I unzipped the project, opened it with File->Open->Folder, the CMake configuration starts and succeeds. Fist thing I notice is that there's no more Build menu, no F7 shortcut to build my project, but instead, I have to select CMake->Build CMakeLists.txt :-( The Debug menu is similarly stunted, and quick debugging is why I use Visual Studio in the first place. This is already looking bad, but it gets worse:
The build fails with this output:
foo.vcxproj -> C:\Users\Enno\AppData\Local\CMakeBuild\639e9ecd-8891-eb38-b26b-ce84aa448eea\build\x86-Debug\foo\Debug\foo.dll
C:\Users\Enno\AppData\Local\CMakeBuild\639e9ecd-8891-eb38-b26b-ce84aa448eea\build\x86-Debug\bar\LINK : fatal error LNK1104: cannot open file '..\foo\Debug\foo.lib'
Thoughts:
The build directory is in %APPDATA%? That's going to be annoying.
There is indeed no .lib file in that location, just the .dll.
At this point I was becoming skeptical that this may not be a problem with VS2017, but maybe with the sample project itself, or with CMake. So I created a solution for VS2015 with cmake.exe -G "Visual Studio 14" ., which I opened in VS2015 and Voila! I got the same error message.
Is there a CMake genius on SO that can tell me what is wrong with this project?
Turns out: The example on the CMake wiki is not portable in the first place, so this has nothing to do with Visual Studio's built-in CMake support. It does not take into account that Windows needs export libraries for DLLs. Adding the correct __declspec(dllexport) incantations to foo.h resolves the error message.
I found all the information that I needed about shared libraries on Windows at this link:
http://gernotklingler.com/blog/creating-using-shared-libraries-different-compilers-different-operating-systems/

OpenCV error in Visual Studio 2010: fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'

I have installed OpenCV 2.4.3 on Windows 7-64 bit. I am using Visual Studio 2010. OpenCV is installed in c:/opencv. I have added the environmental variables and all the necessary library dependecies. But, I always get this error :
fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'.
The settings for VS2010 linker options is like below:
Additional Library Directories: C:\opencv\build\x64\vc10\lib
Additional Dependencies: I have listed all the libraries available in
the directory mentioned above.
But when I run I get that error. This library actually exists in the mentioned directory, but I don't know why I get this error. I have seen some other people ask similar questions, but none of the solutions could solve my problem.
use dependency walker tool to make sure u have all necessary dlls & libs loaded...
'opencv_calib3d243.obj' != 'opencv_calib3d243.lib' !
it should be 'lib', but you probably typed 'obj' there (which does not exist), look at it again.
Go to Project properties ->Configuration Properties -> Linker -> Input -> Additional Dependencies
In additional dependencies add
opencv_core243.lib
opencv_imgproc243.lib
opencv_highgui243.lib
opencv_ml243.lib
opencv_video243.lib
opencv_features2d243.lib
opencv_calib3d243.lib
opencv_objdetect243.lib
opencv_contrib243.lib
opencv_legacy243.lib
opencv_flann243.lib
If you have already added , make sure you have added opencv_calib3d243.lib
had the same problem, except VS was complaining about opencv_.obj instead, (I'm running it under visual studio 2010 express)
Fixed it by copying and pasting the lib dependencies from the provided "opencv_example" example (Project properties->linker->Input:Additional Dependencies).
So for convenience, I have this value in my Additional Dependencies:
opencv_core246d.lib;opencv_imgproc246d.lib;opencv_highgui246d.lib;opencv_ml246d.lib;opencv_video246d.lib;opencv_features2d246d.lib;opencv_calib3d246d.lib;opencv_objdetect246d.lib;opencv_contrib246d.lib;opencv_legacy246d.lib;opencv_flann246d.lib;%(AdditionalDependencies)
Note I: I'm running version 246, so you may have to adjust these names to reflect your installed version which appears to be 243
Note II: I'm compiling for debug, haven't tried release, but you should remove the trailing 'd' from the lib name for correctness.

Linking errors with boost, VS2010, and CMake

I have searched high and low for this answer. I have tried suggestions to similar problems posted on Stack and other sites. My toolchain consists of an x64 machine with windows 7, visual studio 2010, opencv 2.4, qt 4.8, and boost. I configure all of my projects using CMake, which finds all of these libraries and includes and creates my visual studio project. I have compiled two versions of boost, a 32-bit version build in the command line and placed in \boost\boost_1_47_0\lib\win32, and a 64-bit compiled in the Windows SDK v7.1 64-bit compiler and stored in \boost\boost_1_47_0\lib\x64. Everything in the project compiles fine with the exception of boost. I get a compiler error:
fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-1_47.lib'
As a reminder, CMake is handling all of my linking and it properly locates this lib and adds it to the visual studio project. I can verify this by looking at Properties->Linker->Command Line. Here, in addition to files representing other libraries, it has listed:
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_filesystem-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_program_options-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_date_time-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_thread-vc100-mt-1_47.lib"
I can suppress this error by manually adding my boost\boost_1_47_0\lib\x64 directory to Properties->Linker->General->Additional Library Dependencies. This compiles without error. However, when I go to run the application, I am met with a system error that tells me:
The program can't start because boost_filesystem-vc100-mt-1_47.dll is missing from your computer. Try reinstalling the program to fix this problem.
In this /x64 directory I have:
boost_filesystem-vc100-mt-1_47.dll
boost_filesystem-vc100-mt-1_47.lib
libboost_filesystem-vc-100-mt-1_47.dll
Any insight would be incredibly appreciated. Thanks!
To solve the runtime error:
Add the location of the dll(s) to the PATH environment variable.
For example on my machine:
set PATH=%PATH%;c:\users\chris\boost_regex-vc140.1.63.0.0\lib\native\address-model-32\lib
or copy the dll(s) to a directory already in the PATH
See here: https://msdn.microsoft.com/en-us/library/7d83bc18.aspx?f=255&MSPPError=-2147217396

Compiling FFTW source in Visual studio

Recently I am trying to compile the source code of FFTW in Visual studio 2010. I followed the instruction from the FFTW website. I downloaded the source code fftw-3.3.2.zip and corresponding vs 2010 package fftw-3.3-libs-visual-studio-2010.zip.
I got four projects from the solution, bench, benchf, libfftw-3.3, libfftwf-3.3
But on compiling I got following errors on each of the project:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(514,5): error MSB8008: Specified platform toolset (Windows7.1SDK) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected.
which points to the following content
I have tried the debug/release build for both x64 and win32, none of them worked.
Could anyone please help me on this?
It seems that it can be solved without installing the Windows 7.1 SDK
Right click on the 'libfftw-3.3' project and selected properties
Go to Configuration Properties -> General
Switch 'Platfrom Toolset' from 'Windows7.1SDK' to 'v100'
Recompile
Works for the projects 'libfftwf-3.3' and 'libfftw-3.3'
The project 'bench' and 'benchf' are failing to build:
fatal error C1083: Cannot open source file: '....\libbench2\aligned-main.c': No such file or directory
Can be solved by removing the aligned-main.c from both projects.
You can also use CMake - I created this CMake file for fftw-3.3.2 which I tested with Visual Studio 2010 x64:
https://bitbucket.org/Vertexwahn/cmakedemos/src/670f189321d89dbd61ddc8c446c91578305f9da2/fftw-3.3.2/CMakeLists.txt?at=default
You also need this config.h file:
https://bitbucket.org/Vertexwahn/cmakedemos/src/670f189321d89dbd61ddc8c446c91578305f9da2/fftw-3.3.2/config.h?at=default
It looks like you need to install the Windows 7.1 SDK, if you have already installed it, try reinstalling it incase it is corrupted.
You can download the 7.1 SDK from http://www.microsoft.com/en-us/download/details.aspx?id=8279

Building Qt for Visual Studio 2010 - cannot open file 'qtmaind.lib'

I'm trying to start a C++ Qt application and have it run and compile in Visual Studio 2010.
Doing some googling, I found that there was a Visual Studio Qt Add-in, and so I installed this. I already had a MinGW Qt binary installed, and when this did not work, I found that you have to compile the source for Visual Studio 2010 (the VS 2008 binary will cause deployment issues).
Using this as a guide: How to build Qt for Visual Studio 2010, I compiled the open source version, and added it to the PATH, along with a QTDIR env variable. Hoping that I got it finally working, I created a "Qt Application" using the New Project Wizard in Visual Studio 2010. Once I finished, I tried to build the program, only to see the following error:
1>LINK : fatal error LNK1104: cannot open file 'qtmaind.lib'
I looked in the C:\QT\lib folder, and found that I only have a qtmaind.prl, but no clue as to why there is no qtmaind.lib.
I am able to echo the QMAKESPEC environmental variable to get a 'win32-msvc2010' output.
I've tried several different combinations of flags for the configure step, including the one in the link, and even tried manually setting the -platform flag.
If anyone can offer any help, it would be greatly appreciated! :D
Just ran across this same problem. I changed the "-release" flag from the linked guide to "-debug-and-release", and then it built the qtmaind.lib library (presumably, that "d" suffix stands for debug).
I encountered this issue when running a project whose settings were hardcoded for a particular machine setup.
I could see that the vcxproj file had something like:
C:\Qt\4.8.1\libqtmaind.lib
I could not find this lib file in my machine. I replaced the line by:
C:\Qt\4.7.3\lib\Qtmaind.lib
It looks like the names of library files are different across Qt versions.Or, maybe the library files were renamed.
Also, the 'd' denoted debug. If you cannot find any lib file post-fixed by 'd', it is likely that you did not 'make' a debug version of Qt.
You can cross check this by opening the .Sln file created by configure. Mine was named Projects.sln. You can open this in notepad and see if win32-debug configurations are present.
This might be a QMAKESPEC issue. Try setting your QMAKESPEC environment variable to
win32-msvc2010
and rebuild Qt like that. This should give you .lib files in your Qt folder
in QT 5.3 with vs 2013
in properties -> linker -> input
remove ANY path for qt libraries such qtmaind.lib
this is known BUG

Resources