发布版本找不到__declspec(dllimport)公共目录:bool __thiscall std :: basic_ofstream <char,struct std :: char_traits <char =“”>> :: is_open

时间:2019-03-08 10:56:14

标签: c++ visual-studio-2017

我正在维护一个过时的软件堆栈。现在,我不得不重新运行一个工具来创建一些配置文件,它可以编译并与调试配置链接,但不能与发布配置链接。

我们使用Visual C ++ 17企业版。

我打开/ verbose,链接器给出了某种线索:

release 
1>      Found "__declspec(dllimport) public: __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::basic_ofstream<char,struct std::char_traits<char> >(char const *,int,int)" (__imp_??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z)
1>        Referenced in nl.obj
1>        Loaded tl.lib(tl.dll)
1>      Found "__declspec(dllimport) public: void __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::`vbase destructor'(void)" (__imp_??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ)
1>        Referenced in nl.obj
1>        Loaded tl.lib(tl.dll)

debug
1>      Found "__declspec(dllimport) public: __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::basic_ofstream<char,struct std::char_traits<char> >(char const *,int,int)" (__imp_??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z)
1>        Referenced in nl.obj
1>        Loaded tl.lib(tl.dll)
1>      Found "__declspec(dllimport) public: bool __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::is_open(void)const " (__imp_?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBE_NXZ)
1>        Referenced in nl.obj
1>        Loaded tl.lib(tl.dll)
1>      Found "__declspec(dllimport) public: void __thiscall std::basic_ofstream<char,struct std::char_traits<char> >::`vbase destructor'(void)" (__imp_??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ)
1>        Referenced in nl.obj
1>        Loaded tl.lib(tl.dll)

就我所记得的模板编程而言,它是关于编译期间代码生成的。创建引用只是为了节省代码大小。

那为什么可视化的c ++编译器为什么在调试而不是发行版中创建is_open方法呢?

有什么想法吗?

0 个答案:

没有答案