1.
>D:\project\vs\obs\ObsProject\obs-studio\plugins\win-wasapi\win-wasapi.cpp(245): error C2065: “KSAUDIO_SPEAKER_2POINT1”: 未聲明的標識符
1>D:\project\vs\obs\ObsProject\obs-studio\plugins\win-wasapi\win-wasapi.cpp(245): error C2131: 表達式的計算結果不是常數
1> D:\project\vs\obs\ObsProject\obs-studio\plugins\win-wasapi\win-wasapi.cpp(245): note: 非常量參數或對非常量符號的引用導致了故障
1> D:\project\vs\obs\ObsProject\obs-studio\plugins\win-wasapi\win-wasapi.cpp(245): note: 請參見“KSAUDIO_SPEAKER_2POINT1”的用法
解決方案:
再win-wasapi.cpp 內添加定義KSAUDIO_SPEAKER_2POINT1 宏:
#define KSAUDIO_SPEAKER_2POINT1 (KSAUDIO_SPEAKER_STEREO|SPEAKER_LOW_FREQUENCY)
2.
D:\project\vs\obs\ObsProject\obs-studio\plugins\win-wasapi\win-wasapi.cpp(245): error C2051: case 表達式不是常量
2>d:\project\vs\obs\obsproject\obs-studio\deps\json11\json11.hpp(110): error C2228: “.begin”的左邊必須有類/結構/聯合 (編譯源文件 D:\project\vs\obs\ObsProject\obs-studio\deps\json11\json11.cpp)
2> d:\project\vs\obs\obsproject\obs-studio\deps\json11\json11.hpp(110): note: 類型是“add_rvalue_reference<_Ty>::type” (編譯源文件 D:\project\vs\obs\ObsProject\obs-studio\deps\json11\json11.cpp)
2>d:\project\vs\obs\obsproject\obs-studio\deps\json11\json11.hpp(110): error C2227: “->first”的左邊必須指向類/結構/聯合/泛型類型 (編譯源文件 D:\project\vs\obs\ObsProject\obs-studio\deps\json11\json11.cpp)
2>d:\project\vs\obs\obsproject\obs-studio\deps\json11\json11.hpp(111): error C2228: “.begin”的左邊必須有類/結構/聯合 (編譯源文件 D:\project\vs\obs\ObsProject\obs-studio\deps\json11\json11.cpp)
2> d:\project\vs\obs\obsproject\obs-studio\deps\json11\json11.hpp(111): note: 類型是“add_rvalue_reference<_Ty>::type” (編譯源文件 D:\project\vs\obs\ObsProject\obs-studio\deps\json11\json11.cpp)
2>d:\project\vs\obs\obsproject\obs-studio\deps\json11\json11.hpp(111): error C2227: “->second”的左邊必須指向類/結構/聯合/泛型類型 (編譯源文件 D:\project\vs\obs\ObsProject\obs-studio\deps\json11\json11.cpp)
解決方案:
參考之前版本的json11 然后提換一下現在的json11文件。
具體差異:
再 json11.hpp 添加:
// declval example
#include <utility> // std::declval
#include <iostream> // std::cout
template<class T>
typename std::add_rvalue_reference<T>::type declval() noexcept;
using namespace std;
然后下面提換內容:
//此處最新版的代碼編譯會有問題所以注釋起來還是使用之前版本的代碼進行編譯 by_songgp add20190422 /* // Implicit constructor: anything with a to_json() function. template <class T, class = decltype(&T::to_json)> Json(const T & t) : Json(t.to_json()) {} // Implicit constructor: map-like objects (std::map, std::unordered_map, etc) template <class M, typename std::enable_if<std::is_constructible<std::string, decltype((std::declval<M>()).begin()->first)>::value&& std::is_constructible<Json, decltype(std::declval<M>().begin()->second)>::value, int>::type = 0> Json(const M & m) : Json(object(m.begin(), m.end())) {} // Implicit constructor: vector-like objects (std::list, std::vector, std::set, etc) template <class V, typename std::enable_if<std::is_constructible<Json, decltype(*std::declval<V>().begin())>::value, int>::type = 0>Json(const V & v) : Json(array(v.begin(), v.end())) {} // This prevents Json(some_pointer) from accidentally producing a bool. Use // Json(bool(some_pointer)) if that behavior is desired. Json(void *) = delete; // Accessors Type type() const; */ // Implicit constructor: anything with a to_json() function. template <class T, class = decltype(&T::to_json)> Json(const T & t) : Json(t.to_json()) {} // Implicit constructor: map-like objects (std::map, std::unordered_map, etc) template <class M, typename std::enable_if< std::is_constructible<std::string, typename M::key_type>::value && std::is_constructible<Json, typename M::mapped_type>::value, int>::type = 0> Json(const M & m) : Json(object(m.begin(), m.end())) {} // Implicit constructor: vector-like objects (std::list, std::vector, std::set, etc) template <class V, typename std::enable_if< std::is_constructible<Json, typename V::value_type>::value, int>::type = 0> Json(const V & v) : Json(array(v.begin(), v.end())) {} // This prevents Json(some_pointer) from accidentally producing a bool. Use // Json(bool(some_pointer)) if that behavior is desired. Json(void *) = delete; // Accessors Type type() const;
3.
-preview.cpp(932): error C2719: 'transform': formal parameter with requested alignment of 16 won't be aligned
原因可能是因為vs2015 編譯的是win3
解決方案:
修改 window-basic-preview.cpp 文件中
static bool IntersectBox(matrix4 transform, float x1, float x2, float y1, float y2)
為下面的內容:
static bool IntersectBox(matrix4& transform, float x1, float x2, float y1, float y2)
參考:
https://blog.csdn.net/kupepoem/article/details/44239193