Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when building the provided main function #7

Open
AbdouMechraoui opened this issue Jul 18, 2021 · 3 comments
Open

Errors when building the provided main function #7

AbdouMechraoui opened this issue Jul 18, 2021 · 3 comments

Comments

@AbdouMechraoui
Copy link

I am trying to run the code provided in the README file. However, I get a list of errors when trying to build it using vs, I've included the capture.hpp directory to My_Proj properties -> C/C++ -> Additional Include Directories -> "path to capture.hpp". I have included the errors I get below, please let me know what I am doing wrong.

..\My_Project\screencapture-master\capture.hpp(73): error C2039: 'recursive_mutex': is not a member of 'std'
1>program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\vector(20): note: see declaration of 'std'
1>..\My_Project\screencapture-master\capture.hpp(73): error C2143: syntax error: missing ';' before '*'
1>..\My_Project\screencapture-master\capture.hpp(73): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\My_Project\screencapture-master\capture.hpp(73): error C2238: unexpected token(s) preceding ';'
1>..\My_Project\screencapture-master\capture.hpp(74): error C2039: 'recursive_mutex': is not a member of 'std'
1>program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\vector(20): note: see declaration of 'std'
1>..\My_Project\screencapture-master\capture.hpp(74): error C2061: syntax error: identifier 'recursive_mutex'
1>..\My_Project\screencapture-master\capture.hpp(76): error C2065: 'mm': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(76): error C2065: 'm': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(77): error C2065: 'm': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(81): error C2065: 'mm': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(206): error C2039: 'recursive_mutex': is not a member of 'std'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\vector(20): note: see declaration of 'std'
1>..\My_Project\screencapture-master\capture.hpp(206): error C3646: 'm': unknown override specifier
1>..\My_Project\screencapture-master\capture.hpp(206): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\My_Project\screencapture-master\capture.hpp(218): error C2065: 'm': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(251): error C2065: 'm': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(259): error C2065: 'm': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(276): error C2065: 'm': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(313): error C2061: syntax error: identifier 'CComPtr'
1>..\My_Project\screencapture-master\capture.hpp(315): error C2065: 'trs': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(317): error C2065: 's': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(317): error C2065: 'trs': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(318): error C3536: 'hr': cannot be used before it is initialized
1>..\My_Project\screencapture-master\capture.hpp(324): error C2065: 'MFT_INPUT_STREAM_INFO': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(324): error C2146: syntax error: missing ';' before identifier 'six'
1>..\My_Project\screencapture-master\capture.hpp(324): error C2065: 'six': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(325): error C2065: 'trs': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(325): error C2065: 'six': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(327): error C2065: 'MFT_OUTPUT_STREAM_INFO': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(327): error C2146: syntax error: missing ';' before identifier 'si'
1>..\My_Project\screencapture-master\capture.hpp(327): error C2065: 'si': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(328): error C2065: 'CComPtr': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(328): error C2065: 'IMFMediaBuffer': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(328): error C2065: 'bb': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(329): error C2065: 'si': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(330): error C2065: 'trs': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(330): error C2065: 'si': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(331): error C2065: 'CComPtr': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(331): error C2065: 'IMFSample': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(331): error C2065: 'pSample2': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(332): error C2065: 'si': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(332): error C2065: 'MFT_OUTPUT_STREAM_PROVIDES_SAMPLES': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(334): error C2065: 'si': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(338): error C2065: 'pSample2': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(338): error C3861: 'MFCreateSample': identifier not found
1>..\My_Project\screencapture-master\capture.hpp(339): error C2065: 'si': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(339): error C2065: 'bb': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(339): error C3861: 'MFCreateMemoryBuffer': identifier not found
1>..\My_Project\screencapture-master\capture.hpp(340): error C2065: 'pSample2': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(340): error C2065: 'bb': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(343): error C2065: 'MFT_OUTPUT_DATA_BUFFER': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(343): error C2146: syntax error: missing ';' before identifier 'db'
1>..\My_Project\screencapture-master\capture.hpp(343): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(344): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(345): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(345): error C2065: 'pSample2': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(346): error C2065: 'si': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(346): error C2065: 'MFT_OUTPUT_STREAM_PROVIDES_SAMPLES': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(347): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(350): error C2065: 'trs': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(350): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(353): error C2065: 'trs': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(353): error C2065: 's': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(354): error C2065: 'trs': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(354): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(358): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(359): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(360): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(362): error C2065: 'sx': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(364): error C2065: 'sx': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(364): error C2065: 'db': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(365): error C2065: 'si': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(365): error C2065: 'MFT_OUTPUT_STREAM_PROVIDES_SAMPLES': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(366): error C2065: 'sx': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(383): error C2039: 'map': is not a member of 'std'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.16.27023\include\vector(20): note: see declaration of 'std'
1>..\My_Project\screencapture-master\capture.hpp(383): error C2143: syntax error: missing ';' before '<'
1>..\My_Project\screencapture-master\capture.hpp(383): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\My_Project\screencapture-master\capture.hpp(383): error C2238: unexpected token(s) preceding ';'
1>..\My_Project\screencapture-master\capture.hpp(394): error C2061: syntax error: identifier 'CComPtr'
1>..\My_Project\screencapture-master\capture.hpp(387): error C2065: 'maps': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(388): error C3536: 'mo': cannot be used before it is initialized
1>..\My_Project\screencapture-master\capture.hpp(388): error C2065: 'maps': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(396): error C2065: 'ac': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(398): error C2065: 'CComPtr': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(398): error C2275: 'IMMDeviceEnumerator': illegal use of this type as an expression
1>c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\mmdeviceapi.h(703): note: see declaration of 'IMMDeviceEnumerator'
1>..\My_Project\screencapture-master\capture.hpp(398): error C2065: 'deviceEnumerator': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(399): error C2065: 'deviceEnumerator': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(400): error C2065: 'deviceEnumerator': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(403): error C2065: 'CComPtr': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(403): error C2275: 'IMMDevice': illegal use of this type as an expression
1>c:\program files (x86)\windows kits\10\include\10.0.17763.0\um\mmdeviceapi.h(389): note: see declaration of 'IMMDevice'
1>..\My_Project\screencapture-master\capture.hpp(403): error C2065: 'd': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(404): error C2065: 'deviceEnumerator': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(404): error C2065: 'd': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(405): error C2065: 'd': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(407): error C3536: 'hr': cannot be used before it is initialized
1>..\My_Project\screencapture-master\capture.hpp(407): error C2065: 'd': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(407): error C2065: 'ac': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(408): error C2065: 'ac': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(414): error C2065: 'ac': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(418): error C2065: 'maps': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(422): error C2065: 'AllShared': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(431): error C2065: 'maps': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(445): error C2065: 'ac': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(446): error C3536: 'hr': cannot be used before it is initialized
1>..\My_Project\screencapture-master\capture.hpp(447): error C2065: 'maps': undeclared identifier
1>..\My_Project\screencapture-master\capture.hpp(447): fatal error C1003: error count exceeds 100; stopping compilation
1>Done building project "My_Project.vcxproj" -- FAILED.`

@WindowsNT
Copy link
Owner

You need to include the required headers also.

I have these in my stdafx.h. Perhaps you don't want all of them.

#include <winsock2.h>
#include <windows.h>
#include <wininet.h>
#include <process.h>
#include <commctrl.h>
#include <stdio.h>
#include <mutex>
#include <queue>
#include <sstream>
#include <map>
#include <thread>
#include <string>
#include <vector>
#include <tchar.h>
#include <memory>
#include <functional>
#include <atlbase.h>
#include <codecapi.h>
#include <mfidl.h>
#include <mfapi.h>
#include <mfreadwrite.h>
#include <dshow.h>
#include <effects.h>
#include <Wmcodecdsp.h>
#include <setjmp.h>
#include <Mferror.h>
#include <optional>
#include <d2d1.h>
#include <d2d1_1.h>
#include <d2d1_2.h>
#include <d2d1_3.h>
#include <dxgi.h>
#include <wincodec.h>
#include <dxgi1_2.h>
#include <d3d11.h>
#include <shlobj.h>
#include <propvarutil.h>

@AbdouMechraoui
Copy link
Author

Thank you so much for your reply.
I had some issues with platform toolset in vs, once I used vs2017 v141 instead of v142 I was able to build it.
I am not sure what the expected behavior of the program is? Right now it runs successfully, but it doesn't output any recorded videos. I also noticed that it's done running in less than 10 seconds, which is the set duration of the screen capture in the sample code.
Is there a way to specify the path of the output video? and is it normal for the program to run for less than 10 seconds when the duration of screen capture is 10 seconds?
Any help is highly appreciated :)

@WindowsNT
Copy link
Owner

Take a look at the readme
https://github.com/WindowsNT/ScreenCapture

It has a simple 10 second example which specifies the output video and all parameters are configutable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants