1.无法解析的外部符号 __std_reverse_trivially_swappable_8
-
情况:编译完ompl后,利用生成的静态库文件写应用程序,编译的时候报的这个错;
-
解决:网上说这个大多是由于vs的编译器版本不匹配导致的,查了一下,果然如此,ompl用vs2017编译生成的,最后写应用程序的时候因为是在qtcreator里面写,没有正确设置版本,改为vs2017的编译器之后问题解决。
2.VS错误 :
代码:C2338
描述:You've instantiated std::aligned_storage<Len, Align> with an extended alignment (in other words, Align > alignof(max_align_t)). Before VS 2017 15.8, the member type would non-conformingly have an alignment of only alignof(max_align_t). VS 2017 15.8 was fixed to handle this correctly, but the fix inherently changes layout and breaks binary compatibility (*only* for uses of aligned_storage with extended alignments). Please define either (1) _ENABLE_EXTENDED_ALIGNED_STORAGE to acknowledge that you understand this message and that you actually want a type with an extended alignment, or (2) _DISABLE_EXTENDED_ALIGNED_STORAGE to silence this message and get the old non-conformant behavior.
- 情况:编译Robotics Library的时候遇到的错误;
- 解决:参考了这里:https://gamedev.amazon.com/forums/questions/71621/vs2017-158-stdaligned-storage-error.html;按照上面的说明在报错的工程的 预处理器定义 中加了 _ENABLE_EXTENDED_ALIGNED_STORAGE 之后不再报错。
3.LPTSTR无法转为std::string 或 “const char *”无法转为“LPCWSTR”
- 情况:在使用WindowsAPI时经常遇到这样的编译错误;
- 解决:设置属性字符集貌似能解决这个问题。vs中可以查看一下项目属性->常规中的字符集选项,将其选择的Unicode改为未设置或者多字节尝试一下。QtCreator中可以在pro文件里面加 DEFINES -= UNICODE;
4.NMAKE:-1: error: U1077: 'QTDIR\bin\rcc.exe' : return code '0x1'
- 情况:QT工程中遇到的,感觉毫无指向性。
- 解决:直接复制错误内容搜了一下,瞬间找到解决方式。 一般来说,资源文件qrc里面包含了文件而实际路径没有这个文件,会报这个错。所以检查一下资源文件中的文件即可。
5.原VS动态库工程改为静态库工程编译后,引用出现未实现的函数报错
- 情况:如上所述,原本的VS动态库工程,在属性中直接改为静态库工程后,能正确生成lib文件,然而在引用这个lib文件时,出现了报错,就是一些函数未实现的报错。
- 解决:__declspec( dllexport ) 以及 __declspec( dllimport ) 是在动态库中才需要用到的,静态库中会使得找不到后面定义的函数,所以删掉这个就ok了。
6.VS默认库函数重定义
- 情况:如上所述,一些VS或者系统的默认库函数的重定义报错。如下:
- 解决:VS中在属性->配置->C/C++->链接器->输入->忽略特定默认库中可以操作;QT中在pro文件中增加
QMAKE_LFLAGS_DEBUG = /DEBUG /NODEFAULTLIB:****.lib
其中/DEBUG可更改。
以后慢慢补充。。。