Use of PCH and /Zi with Boost* Libraries May Result in unresolved external symbols due to Anonymous Namespace Use

Reference Number : DPD200135511

Version : 11.1

Operating System : Windows*

Problem Description : The Boost* STL library's bind functionality uses a construct called placeholders to bind function arguments to a function.  Boost implements these placeholders in an anonymous namespace which the Intel® C++ Compiler has problems with when pre-compiled header files are used and debug symbol generation is enabled.  The following code demonstrates the problem (requires Boost* libraries).

#include <boost/bind.hpp>
#include "pch.h"
#include "pch.h" class blh_widge { public: void Init(); private: void OnInputComplete(int, int, int); }; void blh_widge::Init() { boost::bind(&blh_widge::OnInputComplete, this, _1, _2, _3) {} } int main() { return(0); }
icl -Od -I<boost include> -Ycpch.h -Fptest-bind.pch -c -Zi pch.cpp icl -Od -I<boost include> -Yupch.h -Fptest-bind.pch -Zi test-bind.cpp test-bind.cpp Microsoft ® Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. -out:test-bind.exe -debug -pdb:test-bind.pdb test-bind.obj test-bind.obj : error LNK2019: unresolved external symbol "struct boost::arg<1> __N_13_test_bind_cpp_main::_1" (?_1@__N_13_test_bind_cpp_main@@3U?$arg@$00@boost @@A) referenced in function ___sti__?_1@__N_13_test_bind_cpp_main@@3U?$arg@$00@b oost@@A test-bind.obj : error LNK2019: unresolved external symbol "struct boost::arg<2> __N_13_test_bind_cpp_main::_2" (?_2@__N_13_test_bind_cpp_main@@3U?$arg@$01@boost @@A) referenced in function ___sti__?_2@__N_13_test_bind_cpp_main@@3U?$arg@$01@b oost@@A test-bind.obj : error LNK2019: unresolved external symbol "struct boost::arg<3> __N_13_test_bind_cpp_main::_3" (?_3@__N_13_test_bind_cpp_main@@3U?$arg@$02@boost @@A) referenced in function ___sti__?_3@__N_13_test_bind_cpp_main@@3U?$arg@$02@b oost@@A test-bind.exe : fatal error LNK1120: 3 unresolved externals

Resolution Status : This issue is resolved in the Intel® Parallel Composer Update 1 or Intel® C++ Compiler Professional Edition for Windows* 11.1.038.

[DISCLAIMER: The information on this web site is intended for hardware system manufacturers and software developers. Intel does not warrant the accuracy, completeness or utility of any information on this site. Intel may make changes to the information or the site at any time without notice. Intel makes no commitment to update the information at this site. ALL INFORMATION PROVIDED ON THIS WEBSITE IS PROVIDED "as is" without any express, implied, or statutory warranty of any kind including but not limited to warranties of merchantability, non-infringement of intellectual property, or fitness for any particular purpose. Independent companies manufacture the third-party products that are mentioned on this site. Intel is not responsible for the quality or performance of third-party products and makes no representation or warranty regarding such products. The third-party supplier remains solely responsible for the design, manufacture, sale and functionality of its products. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. *Other names and brands may be claimed as the property of others.]
For more complete information about compiler optimizations, see our Optimization Notice.