visual-c++

Media Foundation EVR no video displaying

旧时模样 提交于 2020-02-20 10:32:51
问题 I've been trying in vain to come up with a no frills example of displaying video using Microsoft's Media Foundation Enhanced Video Renderer (EVR). I'm testing on Windows 7 with Visual Studio 2013. I'm pretty sure I've got the media types configured correctly as I can export and save the buffer from the IMFSample in my read loop to a bitmap. I can also get the video to render IF I get MF to automatically generate the topology but in this case I need to wire up the source reader and sink writer

Forward-declared type and “non-class type as already been declared as a class type”

☆樱花仙子☆ 提交于 2020-02-20 08:28:29
问题 I have problem with following code: template <typename T> void foo(struct bar & b); struct bar {}; int main(){} It compiles successfuly on GCC, but fails on MSVC (2008) with following error: C2990: 'bar' : non-class type as already been declared as a class type Is the code wrong or it's a bug in MSVC? It works if I add struct bar; before template definition. 回答1: And we have our winner: https://connect.microsoft.com/VisualStudio/feedback/details/668430/forward-declared-type-and-non-class-type

Reading file content opened with ifstream

我的梦境 提交于 2020-02-07 05:22:04
问题 I have a problem reading file, opened with fstream on windows. std::ifstream file(file_name); if(!file.is_open()){ std::cerr << "file cannot be opened"; } if (!file){ std::cerr << "errors in file"; } std::vector<std::string> strings; std::string str; while (std::getline(file, str)) { strings.push_back(str); } File opened sucessfully and it has no errors, but cycle with getline gets no content. Besides this sample runs perfect and prints whole file content std::copy(std::istream_iterator<std:

should divide by zero raise an exception

≯℡__Kan透↙ 提交于 2020-02-06 07:51:32
问题 I've been debugging a C++ application in VS2015 and found that a number of my double variables were ending up a NaN following a divide by zero. While this is reasonable, I have floating point exceptions enabled (/fp:except) so I would have expected this to raise an exception. Looking at the MS help page, it doesn't list what causes a floating point exception. According to this answer to a related question, divide by zero is a floating point exception. This is not the case, i.e. the following

Formatting differences between sprintf() and wsprintf() in VS2015

你说的曾经没有我的故事 提交于 2020-02-06 07:43:30
问题 I am moving some code from multibyte to unicode, and finding my string formatting coming out wrong. It looks like Visual Studio 2015 handles the width argument specifier '*' differently between sprintf() and wsprintf(). Is this a compiler bug or side-effect, or am I missing something really obvious? Code below, with output: char cOutA [ 64 ]; wchar_t wcOutA [ 64 ]; sprintf ( cOutA, "Multibyte = %.*f\n", 3, 2.12345 ); wsprintf ( wcOutA, L"Unicode = %.*f\n", 3, 2.12345 ); printf ( cOutA );

Is there anyway to set the VC++ Directories at project level in VS2008 as in VS2010?

对着背影说爱祢 提交于 2020-02-05 04:40:49
问题 In VS2010 the VC++ Directories editing in Tools > Options has been deprecated. VC++ Directories are now available as a user property sheet, which is very convenient to keep the include/lib directories depending on different projects. Is there any way to do the similar thing in VS2008? 回答1: After digging around, I figured out a way to partially do it: still with the property sheet. we can create a new property sheet and set following items: C/C++->additional include directories linker-

Variadic base class using declaration fails to compile in MSVC

夙愿已清 提交于 2020-02-04 20:57:19
问题 I'm trying to implement a variadic visitor class. template<typename T> class VisitorBaseFor { protected: virtual ~VisitorBaseFor() = default; public: virtual void visit(T &t) = 0; }; template<typename... Ts> class VisitorBase : public VisitorBaseFor<Ts>... { public: using VisitorBaseFor<Ts>::visit...; }; I know from that overload trick that variadic using declarations should be possible, but MSVC does not compile my code saying I need to expand Ts while both GCC and Clang compile my code

Why do we get the build error “error C2065: 'ostringstream' : undeclared identifier” & How to fix this?

五迷三道 提交于 2020-02-04 09:35:23
问题 Hi I am compilinig a C++ solution in VS2008. ostringstream strout; I am getting the compilation error " error C2065: 'ostringstream' : undeclared identifier ". I feel I have included all the necessary header files. Can anyone kindly let me know how to fix this error (What all header files to include) ? Also I am getting a strange error like "error C2146: syntax error : missing ';' before identifier 'strout' " at the same line. Whereas I know that I havent missed ";" semi-colon @ the line whre

Why do we get the build error “error C2065: 'ostringstream' : undeclared identifier” & How to fix this?

安稳与你 提交于 2020-02-04 09:34:06
问题 Hi I am compilinig a C++ solution in VS2008. ostringstream strout; I am getting the compilation error " error C2065: 'ostringstream' : undeclared identifier ". I feel I have included all the necessary header files. Can anyone kindly let me know how to fix this error (What all header files to include) ? Also I am getting a strange error like "error C2146: syntax error : missing ';' before identifier 'strout' " at the same line. Whereas I know that I havent missed ";" semi-colon @ the line whre

Why do we get the build error “error C2065: 'ostringstream' : undeclared identifier” & How to fix this?

妖精的绣舞 提交于 2020-02-04 09:33:06
问题 Hi I am compilinig a C++ solution in VS2008. ostringstream strout; I am getting the compilation error " error C2065: 'ostringstream' : undeclared identifier ". I feel I have included all the necessary header files. Can anyone kindly let me know how to fix this error (What all header files to include) ? Also I am getting a strange error like "error C2146: syntax error : missing ';' before identifier 'strout' " at the same line. Whereas I know that I havent missed ";" semi-colon @ the line whre