boost - adding path to 'corecrt.h' - c++

I have a hello.cpp file and I used a tutorial about boost installation from here.
I did everything like they said and I have a problem trying to run it.
I get:
...found 9 targets...
...updating 3 targets...
compile-c-c++ bin\msvc-14.0\debug\hello.obj
hello.cpp
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\crtdefs.h(10): fatal error C1083: Cannot open include file: 'corecrt.h': No such file or directory
call "C:\Users\Paula\AppData\Local\Temp\b2_msvc_14.0_vcvarsall_x86.cmd" >nul
cl /Zm800 -nologo #"bin\msvc-14.0\debug\hello.obj.rsp"
...failed compile-c-c++ bin\msvc-14.0\debug\hello.obj...
...skipped <pbin\msvc-14.0\debug>hello.exe for lack of <pbin\msvc-14.0\debug>hello.obj...
...skipped <pbin\msvc-14.0\debug>hello.pdb for lack of <pbin\msvc-14.0\debug>hello.obj...
...failed updating 1 target...
...skipped 2 targets...
I have corecrt.h in:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt
and in:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt
I tried setting includes and libraries like here Unable to compile and link simple C++ program with Visual Studio 2015 command line tools but it doesn't work for me. I tried to find help here: Introducing the Universal CRT, but I'm not creating any project in VS, just trying to run one with a Command Prompt and I'm not sure what to do in my case. I'm totally new in this topic and I know my question may be stupid, but I really need it. I spent many hours trying to solve it and I have nothing.

Found solution here: https://svn.boost.org/trac/boost/ticket/11487
1) Go to %TEMP% folder
2) Remove all b2_*.cmd files

Related

"Cannot open input file 'libcrypto.lib'" while installing libtorrent C++ library

I am attempting to install the libtorrent C++ library (cloned from GitHub repository) on Windows 11 with OpenSSL 1.1.1i installed and Visual Studio 2022.
Invoking b2 in my libtorrent source folder is returning the error LINK : fatal error LNK1181: cannot open input file 'libcrypto.lib'.
The file libcrypto.lib definitely exists in C:\Users\Me\openssl and C:\Users\Me\openssl is in my PATH. Installation was running fine until this point.
My steps were:
$ set LIB="C:\Users\Me\openssl";%LIB%
$ set INCLUDE="C:\Users\Me\openssl\include";%INCLUDE%
$ set BOOST_ROOT=c:\boost_1_80_0
$ set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build
$ cd "C:\Users\Me\libtorrent"
$ b2
The last step returns:
...updating 3 targets... msvc.link.dll
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.dll
LINK : fatal error LNK1181: cannot open input file 'libcrypto.lib'
call "bin\standalone\msvc\msvc-14.3\msvc-setup.bat" >nul link /NOLOGO /INCREMENTAL:NO
#"bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.dll.rsp"
...failed msvc.link.dll
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.dll
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent.lib
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.pdb...
...removing
bin\msvc-14.3\debug\cxxstd-14-iso\threading-multi\torrent-rasterbar.pdb
...failed updating 3 targets...
Edit: Fixed a typo
Solved by copying libcrypto.lib to LIB path specified in user-config.jam.

Boost build fails with "failed common.mkdir build"

I am trying to build Boost 1.77 using Visual Studio Enterprise 2017 on Windows 10:
I download file boost_1_77_0.zip and uncompress it.
I open an "x86 Native Tools Command Prompt" and cd to the boost_1_77_0 directory.
I run bootstrap.
I run b2...
.\b2 --build-dir=build/x86 address-model=32 architecture=x86 toolset=msvc-14.1 --build-type=complete stage
...this fails and in file boost_1_77_0\build\x86\boost\bin.v2\config.log I have:
...found 20 targets...
...updating 16 targets...
if not exist "build\\" mkdir "build"
...failed common.mkdir build...
...skipped build\x86 for lack of build...
...skipped build\x86\boost for lack of build\x86...
[snip]
...skipped build\x86\boost\bin.v2\check\predef\msvc-14.1\release\address-model-32\architecture-x86\runtime-link-static\threading-multi for lack of build\x86\boost\bin.v2\check\predef\msvc-14.1\release\address-model-32\architecture-x86\runtime-link-static...
...skipped <pbuild\x86\boost\bin.v2\check\predef\msvc-14.1\release\address-model-32\architecture-x86\runtime-link-static\threading-multi>predef_check_cc_09a06289f4560e2f553bb0cbbec71436.obj for lack of build\x86\boost\bin.v2\check\predef\msvc-14.1\release\address-model-32\architecture-x86\runtime-link-static\threading-multi...
...skipped 3 targets...
...found 1 target...
...updating 1 target...
config-cache.write build\x86\boost\bin.v2\project-cache.jam
This program is blocked by group policy. For more information, contact your system administrator.
type "C:\Users\my_username\AppData\Local\Temp\jam5298fccb.000" > "build\x86\boost\bin.v2\project-cache.jam"
...failed config-cache.write build\x86\boost\bin.v2\project-cache.jam...
...failed updating 1 target...
Any idea what I'm doing wrong? I see that error about group policy but I can't find the root cause of it. When I execute that "type" command at the command line it completes successfully.
Edit: I found a solution which I posted below as an answer. Stackoverflow forbids me from marking that answer as accepted because my account is not old enough.
Something within the bowels of the boost build system is attempting to do something for which I lack the necessary permissions. The workaround was to launch a command window from within Visual Studio (rather than from the windows start menu) and invoke the build from there. The organization is forced to allow VS to run with elevated permissions, and these are inherited by the command window, which then allows the boost build to succeed.

Cannot successfully install Boost.Python

I am trying to install Boost.Python on my computer. (Windows7 64bit, Visual Studio 2012, Python 2.7 64bit and Boost 1.54)
Following the instruction, I've successfully installed the Boost Library, and then I have to separately install Boost.Python.
However, as I followed the instruction at here. I am stuck at step 3.1.4.
I input C:\boost_1_54_0\…\quickstart> bjam toolset=msvc --verbose-test test
Then there are 135 unresolved external errors pop out. One of them is:
exec.obj : error LNK2019: unresolved external symbol
__imp__PyEval_GetGlobals referenced in function "class boost::python::api::object __cdecl boost::python::eval(class
boost::python::str,class boost::python::api::object,class
boost::python::api::object)"
(?eval#python#boost##YA?AVobject#api#12#Vstr#12#V3412#1#Z)........\bin.v2\libs\python\build\msvc-11.0\debug\boost_python-vc110-gd-1_54.dll
May I know how can I work around this?
=========================================================
Edit:
Following #Kyle 's advice, I've uninstalled the 64bit Python and replace it with a 32bit Python (2.7.5).
Then I've wrote a very simple code, which is like follows:
#include <boost\python.hpp> // This header used to raise error before
#include <Python.h>
using namespace std;
void main()
{
return;
}
It works well. Then my curiosity pushed me one step further, and I tried the example in my first post. It turns out that those 135 unresolved external errors are gone. Instead, I've got this:
msvc.link.dll bin\msvc-11.0\debug\extending.pyd LINK : fatal error
LNK1104: cannot open file 'boost_python-vc110-mt-gd-1_54.lib'
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
nullink /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /MANIFEST /subsystem:console
/out:"bin\msvc-11.0\debug\extending.pyd"
/IMPLIB:"bin\msvc-11.0\debug\extendi ng.lib"
/LIBPATH:"C:\Python2.7.5\libs"
#"bin\msvc-11.0\debug\extending.pyd.rsp "
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
...failed msvc.link.dll bin\msvc-11.0\debug\extending.pyd
bin\msvc-11.0\debug\extending.lib bin\msvc-11.0\debug\extending.pdb...
...skipped test_ext for lack of extending.pyd...
msvc.link bin\test_embed.test\msvc-11.0\debug\test_embed.exe LINK : warning
LNK4001: no object files specified; libraries used LINK : error
LNK2001: unresolved external symbol _mainCRTStartup
bin\test_embed.test\msvc-11.0\debug\test_embed.exe : fatal error
LNK1120: 1 unresolved externals
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 nul
link /NOLOGO /INCREMENTAL:NO /DEBUG /MACHINE:X86 /MANIFEST /subsystem:console
/out:"bin\test_embed.test\msvc-11.0\debug\test_embed.exe"
/LIBPATH:"C:\Python2.7.5\libs"
#"bin\test_embed.test\msvc-11.0\debug\test_embed.exe.rsp"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
...failed msvc.link bin\test_embed.test\msvc-11.0\debug\test_embed.exe
bin\test_ embed.test\msvc-11.0\debug\test_embed.pdb...
...removing bin\test_embed.test\msvc-11.0\debug\test_embed.pdb
...skipped test_embed.run for lack of test_embed.exe...
...failed updating 5 targets...
...skipped 4 targets...
Sorry to bother you with a large chunk of error message, I just want to provide as more information as I can.
About this boost_python-vc110-gd-1_54.dll, I can find it at C:\local\boost_1_54_0_32bit\lib32-msvc-11.0, while the root of my Boost is C:\local\boost_1_54_0_32bit\.
Can anyone help me work around with this?
Like Kyle C mentioned, this is happening because it can't find the lib. If you want to use 64-bit, you need to specify address-model=64 on the command line, plus have the 64-bit version of python correctly specified in your user-config.jam file.
I documented what I had to do to get this running, see the bottom for 64-bit specific config.
This means that the linker can't properly link to the Python lib. I have run into this before when trying to link to 64bit Python. You should try installing 32bit python and see if that works.

Boost.Python dll being skipped on compile

I am new to python programming and am looking to incorporate some C++ dll's into python. I found boost.python to be the most common answer to this issue and have been trying to test it with a simple 'hello world' application that comes with the boost.python package. Following the tutorial at http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/python/hello.html
I am running Windows 7 using Microsoft Visual Studio 10.0.
My python directory is 'C:\Python27', Boost is 'C:\Boost\boost_1_54_0'
I have set the user-config.jam file to using msvc : 10.0 ; and using python : 2.7 : C:\\Python27 ;
When I invoke bjam I get the following..
...failed msvc.link.dll C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.dll C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.lib C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.pdb...
...removing C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.lib
...removing C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.pdb
...skipped <pbin\msvc-10.0\debug>hello_ext.pyd for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.lib...
...skipped <pbin\msvc-10.0\debug>hello_ext.lib for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.lib...
...skipped <pbin\msvc-10.0\debug>hello_ext.pdb for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.lib...
...skipped <p.>boost_python-vc100-gd-1_54.dll for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.dll...
...skipped <p.>hello_ext.pyd for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...skipped <pbin\hello.test\msvc-10.0\debug>hello for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...failed updating 3 targets...
...skipped 7 targets...
All that is created is an .obj file in:
C:\Boost\boost_1_54_0\libs\python\example\tutorial\bin\msvc-10.0\debug
From my basic limited knowledge it appears the files that are relied upon are being removed just before compilation. I have searched long and hard for a solution but to no avail. It feels like I am missing something very elementary.
Thank you.
EDIT: Updating to python 3.3 seems to have gotten me closer. It is no longer removing the two files from bin.v2, but it is still not compiling a .dll or .pyb file.
PS C:\Boost\boost_1_54_0\libs\python\example\tutorial> .\bjam
...patience...
...patience...
...found 1681 targets...
...updating 7 targets...
msvc.link.dll bin\msvc-10.0\debug\hello_ext.pyd
LINK : fatal error LNK1104: cannot open file 'boost_python-vc100-mt-gd-1_54.lib'
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /MANIFEST /subsystem:console/out:"bin\msvc-10.0\debug\hello_ext.pyd"
/IMPLIB:"bin\msvc-10.0\debug\hello_ext.lib" /LIBPATH:"C:\Python33\libs" #"bin\msvc-10.0\debug\hello_ext.pyd.rsp"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
...failed msvc.link.dll bin\msvc-10.0\debug\hello_ext.pyd bin\msvc-10.0\debug\hello_ext.lib bin\msvc-10.0\debug\hello_ext.pdb bin\msvc-10.0\debug\hello_ext.pdb...
...skipped <p.>hello_ext.pyd for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...failed updating 3 targets...
...skipped 1 target...
SOLVED: First I rebuilt boost.python by running b2 toolset=msvc-10.0 --with-python --user-config=user-config.jam --build-type=complete stage in C:\Boost\boost_1_54_0 then I copied the boost_python-vc100-mt-gd-1_54.lib file into the tutorial folder. Not sure this is the best solution but it seems to now be working.
I suggest to mention python installation path in your configuration file:
using python : 2.7 : C:\Python27\;
Did you cd into the same directory where jamroot and hello.cpp is located?

Trouble building boost 1.48

I am having trouble building boost 1.48 using my normal build command line, which in a Visual Studio x64 Win64 command prompt consists of:
bjam -j 8 --without-mpi --without-python --build-dir=vc100-bld-64-bit
--build-type=complete --toolset=msvc-10.0 architecture=x86
address-model=64 --stagedir=64-bit-vc100 debug-symbols=on
debug-store=database stage
The errors I get are ...failed compile lines towards the bottom of the following output excerpt which complain about precompiled header inconsistencies:
...patience...
...patience...
...patience...
...patience...
...found 9190 targets...
...updating 3251 targets...
common.mkdir 64-bit-vc100
common.mkdir 64-bit-vc100\lib
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static
common.mkdir vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static
compile-c-c++-pch vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\pch.pch
pch.pch.cpp
compile-c-c++ vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\assoc_laguerre.obj
assoc_laguerre.cpp
libs\math\build\..\src\tr1\assoc_laguerre.cpp(6) : error C2858: command-line option 'program database name (/Fde:\dev\devel\libs\boost\boost_1_48_0\vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store
-database\link-static\runtime-link-static\libboost_math_tr1-vc100-sgd-1_48.pdb)' inconsistent with precompiled header, which used '/Fde:\dev\devel\libs\boost\boost_1_48_0\vc100.pdb'
libs\math\build\..\src\tr1\assoc_laguerre.cpp(6) : error C2859: e:\dev\devel\libs\boost\boost_1_48_0\vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\libbo
ost_math_tr1-vc100-sgd-1_48.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.
call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 >nul
cl /Zm800 -nologo #"vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\assoc_laguerre.obj.rsp"
...failed compile-c-c++ vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\assoc_laguerre.obj...
compile-c-c++ vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store-database\link-static\runtime-link-static\assoc_legendre.obj
assoc_legendre.cpp
libs\math\build\..\src\tr1\assoc_legendre.cpp(6) : error C2858: command-line option 'program database name (/Fde:\dev\devel\libs\boost\boost_1_48_0\vc100-bld-64-bit\boost\bin.v2\libs\math\build\msvc-10.0\debug\address-model-64\architecture-x86\debug-store
-database\link-static\runtime-link-static\libboost_math_tr1-vc100-sgd-1_48.pdb)' inconsistent with precompiled header, which used '/Fde:\dev\devel\libs\boost\boost_1_48_0\vc100.pdb'
Is there something about my build command that makes the build fail?
Update: The problems occur due to the debug-store=database command line option to bjam. Is this option's syntax incorrect or did it change in 1.48?
Update 2: If you turn off precompiled headers by adding the pch=off option to the command, this problem goes away, but the build is probably slower, because precompiled headers are disabled.