Been following along with a tutorial for direct x. My most recent compile cam up with an entire slew of what I think are linker errors. I don't know if it is specific to me or not. I have the code here if anybody want to take a kick at the can. Otherwise, any tips on fixing the errors? They're mostly '__in' has not been declared and expected ',' or '...' before '&' token within some header file DXGI.h
Errors:
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\dxgi.h|286|error: '__in' has not been declared|
and
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\dxgi.h|286|error: expected ',' or '...' before '&' token|
Are the first two and Im getting this warning:
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\DXGI.h|9|warning: ignoring #pragma warning [-Wunknown-pragmas]|
I've tried swapping out the DXGI.h file and it still doesn't work along with trying the tutorials exact code(copy and paste) to eliminate chance for error.
Update: Just tried it on an alternate computer and errored out as well.
Related
I feel sorta silly asking this question, but I just cannot find a solution anywhere on the internet.
Notes:
I am using VS2019
C++17 is enabled
My problem is the following:
I want to iterate files in a directory with std::filesystem. To do so, I need to use the directory_iterator. However, when I include the filesystem library, it doesn't find the directory_iterator, so I checked the filesystem header file. It threw me a bunch of errors. I also cannot use experimental/filesystem because for some reason the path class also has errors which make the string functions unusable.
However, when I create a fresh console application, it works fine for me. No errors, directory_iterator has been found, I can iterate without issues.
Here is a small snippet of what the errors I'm being given when trying to compile:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\experimental\filesystem(917,28): warning C4003: not enough arguments for function-like macro invocation 'concat'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\experimental\filesystem(921,1): error C2365: '_InIt': redefinition; previous definition was 'template parameter'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\experimental\filesystem(921): message : see declaration of '_InIt'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include\experimental\filesystem(921,1): error C2061: syntax error: identifier '_First_InIt'
We have a legacy code that uses ATL that was running fine on Windows until we used VS2017 15.6. When we upgraded to 15.7, we started hitting the following compilation error:
1>c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\atlmfc\include\atlconv.h(395): error C3861: 'AtlThrowLastWin32': identifier not found
1>c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.14.26428\atlmfc\include\atlconv.h(406): note: see reference to class template instantiation 'ATL::CA2WEX' being compiled
A quick search found the following link: https://naughter.wordpress.com/2017/01/02/a-comprehensive-comparison-of-the-mfc-atl-changes-in-vs-2017-rc-compared-to-visual-studio-2015-update-3-part-1/
which has the following information:
Line 91: Minor change to comment to fix spelling mistake
Line 94: AtlThrowImpl is now declared as __declspec(noreturn)
Line 112: AtlThrowLastWin32 is now declared as __declspec(noreturn)
We are using both
define _ATL_NO_EXCEPTIONS
define _ATL_CUSTOM_THROW
Has anyone successfully compiled a C++ project that includes ATL on latest VS (15.7) with _ATL_NO_EXCEPTIONS and _ATL_CUSTOM_THROW turned on?
So I'm trying to update a windows build of a project and encountered this error,
1>C:\Program Files (x86)\Windows Kits\8.0\Include\shared\ws2def.h(452): error C2059: syntax error : 'constant'
1>C:\Program Files (x86)\Windows Kits\8.0\Include\shared\ws2def.h(452): error C3805: 'constant': unexpected token, expected either '}' or a ','
I determined that winsock.h must have been included earlier than Winsock2.h which was included in the error'd file so I defined
_WINSOCKAPI_
in the project properties to make sure that didn't happen.
However now I get like 8 other errors from files that include afxsock.h saying "error : MFC requires use of Winsock2.h". So is
_WINSOCKAPI_
preventing afxsock.h from including winsock? Because it seems like I have this circular error and only one set of files can build properly.
The point is that I try to build vlc-qt binding from source. I do the following:
Get libvlc-qt_0.10.0_win32_msvc2013.7z sources
Open my Qt5 Creator (from MVSC2013 version)
Open /src/CMakeLists.txt with it
Run CMake
Press build
Should work, but instead I get the following:
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_threads.h:403: ошибка: C3861: 'poll': identifier not found
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:103: ошибка: C2146: syntax error : missing ';' before identifier 'config_GetIntChoices'
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:103: ошибка: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:104: ошибка: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:105: ошибка: C2146: syntax error : missing ';' before identifier 'config_GetPszChoices'
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:105: ошибка: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:106: ошибка: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
The surprises are that this project searches for some files in the current VLC player installation (Program Files is likely not the best place to get the dependecies), also that nothing's told about this behavior on the repository page, at first sight at at least.
Currently I'm trying to remove/reinstall player, run CMake with some keys etc. By the way, downloading CMake with gui never helped.
Could anyone, please, point me at the mistake in building. Thanks in advance.
UPD:
Thanks, krnekit, it helped to get the key! Ah, it occured to be even more complicated (msvc 2013 update 4 used).
Briefly:
It's pretty hard to build the binding from source via Qt Creator + nmake
Telling CMake with CMAKE_PREFIX_PATH variable, where qt required libraries are helps a lot
The problem of searching vlc player headers in sdk is solved similarly after some of the Cmake configuring
When I started building my sample with the vlc-qt sources included, instead of using the shared dll, I understood that /src/windows contains headers (poll.h and other) are requied to prevent the errors. Don't really know, why it didn't work with Cmake doing it instaed of me
This is a problem with vlc, not with vlc-qt. Your program should be compiled with at least VS 2013 Update 2 (or maybe even more recent).
Alternatively, the quick and dirty solution is to modify vlc includes, see this bugreport for details. You also should provide poll.h include file.
I just discovered the hidden gem crtdbg.h which makes memory leak detection so much easier. Unfortunately, when I linked DirectX into my program today, I got some errors I've never seen before.
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(425): error C2059: syntax error : 'constant'
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(425): error C2091: function returns function
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(425): error C2802: static member 'operator new' has no formal parameters
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(426): error C2059: syntax error : 'constant'
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(426): error C2090: function returns array
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.inl(1003): error C2761: 'void *(__cdecl *_D3DXMATRIXA16::operator new(void))(size_t)' : member function redeclaration not allowed
1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.inl(1003): fatal error C1903: unable to recover from previous error(s); stopping compilation
It seems like when crtdbg overrides the new operator, it breaks something in the DirectX SDK (in case you didn't notice in the errors, I am using the DirectX 11 SDK). Is anything like this documented? A few searches didn't yield any results. I really hope I can continue to use these memory debugging tools, and any workarounds would be greatly appreciated!
Ok, I figured it out. I found this post via Google. (I wish Stack Overflow had shown it to me on the sidebar when I was typing this! Or maybe it did and I missed it...).
Basically, I need to move the including of crtdbg.h, stdlib.h and the definition of _CRTDBG_MAP_ALLOC to a separate header, and use the Forced Include File option under C/C++ >> Advanced in the project properties page to force that include file everywhere. This seems to make it override all other new overrides.