我们正在大量使用boost :: serialization和模板.一切似乎进展顺利.
除此之外,我们在Windows版本上遇到了麻烦.它似乎导致目标文件中的问题太大.我们使用MinGW/Msys和g ++ 4.7.0.
c:/mingw/bin/../lib/gcc/mingw32/4.7.0/../../../../mingw32/bin/as.exe: CMakeFiles/source.dir/sourcecode.cpp.obj: too many sections (33396)
C:\Users\username\AppData\Local\Temp\ccnAocvD.s: Assembler messages:
C:\Users\username\AppData\Local\Temp\ccnAocvD.s: Fatal error: can't write CMakeFiles/source.dir/sourcecode.cpp.obj: File too big
Run Code Online (Sandbox Code Playgroud)
谷歌大师透露了这个存档的消息,http://sourceforge.net/mailarchive/forum.php? thread_name = CA%2Bsc5mkLvj%3DW9w2%3DsY%3Dc_N%3DEwnsQuPDEX%3DiBcbsbxS3CuE_5Bg%40mail.gmail.com&forum_name=mingw- users
在其中,它表明另一个人几乎同样陷入困境.它确实指向了Visual Studio /bigobj选项的一个选项,它似乎可以满足我们的需求.但是,我们无法转移到Visual Studio.
一个建议是在汇编程序选项中添加--hash-size.这没有用.
如果我没有弄错,问题在于目标文件的限制为2 ^ 16个条目.实际上,根据错误信息,我冒昧地说它是签名的2 ^ 16条目,但那是花生./bigobjVisual Studio 的选项会将其更改为2 ^ 32.邮件列表结果不知道gcc的等效选项.进一步的谷歌搜索结果似乎与此无关.
在这一点上,我们将不得不重构我们的代码(呃)以克服这个限制.但是我仍然担心,经过大量模板化,我们可能会一次又一次地遇到这个问题(我们已经遇到了三个源文件).
所以我的问题是这样的; 有没有相当于微软/bigobj选项的gcc ?我还没有找到第三种选择吗?
我从官方网站下载了MinGW版本:http://sourceforge.net/projects/mingw/files/并将其安装在我的Windows 7机器上.
运行g++ --version给了我g++.exe (GCC) 4.8.1,我相信GCC 4.8.1支持C++ 11功能,包括线程.
运行g++ -std=c++11 main.cpp成功编译以下程序.
//main.cpp
#include <memory>
int main() {
std::unique_ptr<int> a(new int);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但运行g++ -std=c++11 main.cpp以下程序:
//main.cpp
#include <mutex>
int main() {
std::mutex myMutex;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
给出错误:
main.cpp: In function `int main()`:
main.cpp:5:5: error: 'mutex' is not a member of 'std'
std::mutex myMutex;
^
main.cpp:5:16: error: expected ';' before 'myMutex'
std::mutex myMutex;
^
Run Code Online (Sandbox Code Playgroud)
好像<mutex>不受支持.编译器没有抱怨#include …
在Windows 10平台上使用mingw32-make命令进行opencv安装,然后可能最终得到以下错误.
Windows版本:10 OpenCv:3.2.0
请建议我安装.
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In constructor 'testing::internal::Mutex::Mutex()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8829:45: error: cannot convert 'CRITICAL_SECTION* {aka _CRITICAL_SECTION*}' to '_RTL_CRITICAL_SECTION*' in initialization
critical_section_(new CRITICAL_SECTION) {
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8830:48: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void InitializeCriticalSection(LPCRITICAL_SECTION)'
::InitializeCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In destructor 'testing::internal::Mutex::~Mutex()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8840:46: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'PCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' to 'void DeleteCriticalSection(PCRITICAL_SECTION)'
::DeleteCriticalSection(critical_section_);
^
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp: In member function 'void testing::internal::Mutex::Lock()':
D:\installers\opencv\sources\modules\ts\src\ts_gtest.cpp:8848:43: error: cannot convert '_RTL_CRITICAL_SECTION*' to 'LPCRITICAL_SECTION {aka _CRITICAL_SECTION*}' for argument '1' …Run Code Online (Sandbox Code Playgroud)