Visual studio包含可见性
Visual studio include visibility
我在visualstudio中遇到了includes的问题。我想为windows和linux编译这个项目。
在visualstudio中,我在.hpp文件中得到了一个小类,它使用了std::exception
和std::is_pod<T>
,但我没有包括type_traits
和stdexcept
!!该文件使用Visual Studio编译得很好!为什么?
在linux上这样做会给我错误
In file included from Packet.hpp:3:0,
from AbstractPacketFactory.hpp:2,
from AuthenticationPacketFactory.hpp:2,
from AuthenticationPacketFactory.cpp:1:
ByteSerializer.hpp: In member function ‘byte_serializer& byte_serializer::operator>>(T&)’:
linux g++是正确的-为什么visualstudio没有警告我?我能做点什么吗?我使用VS作为我的主要IDE,我希望在未来避免这种意外(目前有50个这样的错误…)
我得到了一个出错的函数:
static_assert(std::is_pod<T>, "T must be a POD");
您必须将它与::value
或()
一起使用,但visualstudio编译std::is_pod<T>
时没有任何警告。这就是错误雪崩的原因。。。
您的Visual Studio项目可能被配置为使用预编译头。当您使用预编译头时,stdafx.h就在那里。
只需从预编译头中删除stdafx.h,然后查看编译是否在windows上成功。
您可以在"项目属性">"C++">"预编译头"中找到预编译头。
如果要进行跨平台项目,则应删除"预编译"设置。
相关文章:
- 如何更改唯一指针向量的可见性
- 当指向对象的指针作为参数传递给 std::thread 时,内存可见性
- 限制静态库中符号的可见性 (MSVC/Visual C++)
- 班级成员可见性C++
- 内联模板函数的可见性
- Clang 是否可以在使用可见性属性时生成导入库(不带 __declspec(dllexport))?
- std::mutex 的发布-获取可见性保证是否仅适用于关键部分?
- 符号可见性和 gcc 警告
- C++/libscreen 无法更新可见性
- 在 C++11 线程中,std::mutex 对内存可见性有什么保证?
- C++继承构造函数的可见性
- CRTP - 嵌套叶类类型的可见性
- C++模板 - 实例之间的通用操作和成员可见性
- 放松的订单和线程间可见性
- GCC 6.x警告有关Lambda可见性
- C++ 中的Shared_ptr和内存可见性
- 静态库中的符号可见性和操作
- 未直接继承的基模板类成员的可见性
- Visual studio包含可见性
- Gcc隐藏了来自包含的静态库的符号的可见性