为C ++构建Boost库时出错

问题描述 投票:0回答:1

我正在尝试构建Boost库以在CodeBlocks的C ++项目上使用它,但由于某些错误而无法完成。

我从此页面的网站上下载了7z文件:https://www.boost.org/users/download/Windows版本。

然后我试图在解压缩后生成它。起初它无法找到printf,但是当我在环境变量中将gcc.exe路径上移时,就没有再出现错误窗口了。

所以我再次下载了它以尝试从未修改的版本进行重建,这就是发生的事情

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0>bootstrap.bat gcc -v
Building Boost.Build engine
builtins.cpp: In function 'FILE* windows_popen_wrapper(const char*, const char*)':
builtins.cpp:2483:39: error: '_popen' was not declared in this scope
         result = _popen( command, "r" );
                                       ^
builtins.cpp: In function 'LIST* builtin_shell(FRAME*, int)':
builtins.cpp:2549:29: error: '_pclose' was not declared in this scope
     exit_status = pclose( p );
                             ^
debugger.cpp: In function 'char* debug_string_read(FILE*)':
debugger.cpp:110:33: error: 'strdup' was not declared in this scope
     result = strdup( buf->value );
                                 ^
debugger.cpp: In function 'void debug_init_handles(const char*, const char*)':
debugger.cpp:1073:43: error: '_fdopen' was not declared in this scope
     command_input = _fdopen( read_fd, "r" );
                                           ^
debugger.cpp: In function 'void init_parent_handles(HANDLE, HANDLE)':
debugger.cpp:1091:78: error: '_fdopen' was not declared in this scope
     command_child = _fdopen( _open_osfhandle( (intptr_t)in, _O_RDONLY ), "r" );
                                                                              ^
execnt.cpp: In function 'void try_wait_callback(void*, BOOLEAN)':
execnt.cpp:837:39: error: 'UnregisterWait' was not declared in this scope
     UnregisterWait( slot->wait_handle );
                                       ^
execnt.cpp: In function 'void register_wait(int)':
execnt.cpp:860:52: error: 'RegisterWaitForSingleObject' was not declared in this scope
             WT_EXECUTEDEFAULT | WT_EXECUTEONLYONCE );
                                                    ^
execnt.cpp: In function 'int is_parent_child(DWORD, DWORD)':
execnt.cpp:1085:61: error: 'stricmp' was not declared in this scope
                 if ( !stricmp( pinfo.szExeFile, "csrss.exe" ) &&
                                                             ^
execnt.cpp:1088:60: error: 'stricmp' was not declared in this scope
                 if ( !stricmp( pinfo.szExeFile, "smss.exe" ) &&
                                                            ^
jam.cpp: In function 'int main(int, char**, char**)':
jam.cpp:200:22: error: 'environ' was not declared in this scope
 # define use_environ environ
                      ^
jam.cpp:561:37: note: in expansion of macro 'use_environ'
         var_defines( root_module(), use_environ, 1 );
                                     ^
jam.cpp: In function 'char* executable_path(const char*)':
jam.cpp:729:66: error: 'strdup' was not declared in this scope
     return ( !ret || ret == sizeof( buf ) ) ? NULL : strdup( buf );
                                                                  ^
File Not Found

Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0>

这是bootstrap.log所说的

###
### Using 'gcc' toolset.
###

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0\tools\build\src\engine>g++ -x c++ -std=c++11 -s -O3 -o b2.exe   -DNDEBUG  builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp filent.cpp filesys.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam.cpp jambase.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp object.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp regexp.cpp rules.cpp scan.cpp search.cpp strings.cpp subst.cpp sysinfo.cpp timestamp.cpp variable.cpp w32_getreg.cpp modules/order.cpp modules/path.cpp modules/property-set.cpp modules/regex.cpp modules/sequence.cpp modules/set.cpp  

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0\tools\build\src\engine>dir *.exe 
 Volume in drive C is OS
 Volume Serial Number is 5E38-88DC

 Directory of C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0\tools\build\src\engine


C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0\tools\build\src\engine>copy /b .\b2.exe .\bjam.exe 
The system cannot find the file specified.

这里是我正在使用的gcc版本,来自Codeblocks安装文件中的MinGW文件夹

C:\Users\Trusc\Desktop\boost_1_72_0\boost_1_72_0>gcc --version
gcc (tdm-1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

如果需要,我很乐意提供更多信息。请考虑到我是图书馆新手。

谢谢

c++ boost codeblocks libraries
1个回答
0
投票

我终于解决了这个问题。我了解到1.72.0版本与MinGW存在兼容性问题,因此我又恢复到1.70.0版本,使用MinGW,我已经可以编译它并获取我需要的所有库。

© www.soinside.com 2019 - 2024. All rights reserved.