_com_error, comdef.h -Catching exceptions in D3D12 - windows

I'm experiencing a strange _com_error exception during graphics rendering after attempting to read data from an upload heap in the shader.
After looking up _com_error, it appears one needs to catch it like an exception:
try
{
// attempt to present the scene
System.SwapChain->Present( App.Video.Option.Set(videoSet::VERTICAL_SYNC) ? 1 : 0 );
}
catch(_com_error &x)
{
app_error( x.ErrorMessage() );
}
However, to use _com_error, I apparently need to include comdef.h, and when I include comdef.h, I get a lot of warnings and errors. The first set of the warnings/errors seem to be coming from a secondary include that is apparently included in comdef.h, C:\Windows Kits\10\Include\10.0.22621.0\um\ole2.h. The first thing I tried was to wrap my include (I'm using Visual Studio 2022):
#pragma warning(push, 0)
#include <comdef.h>
#pragma warning(pop)
However, this doesn't seem to work at all, even though it does with every other file I've ever tried to include in my project. Even with this, I still get warnings, which are treated as errors. Here are a few of them:
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(92,41): error C2220: the following warning is treated as an error
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(92,41): warning C4229: anachronism used: modifiers on data are ignored
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(92,41): error C2491: 'OleBuildVersion': definition of dllimport data not allowed
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(92,36): error C2065: 'VOID': undeclared identifier
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(94,50): warning C4229: anachronism used: modifiers on data are ignored
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(94,50): error C2491: 'WriteFmtUserTypeStg': definition of dllimport data not allowed
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(94,47): error C2065: 'IN': undeclared identifier
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(94,50): error C2146: syntax error: missing ')' before identifier 'LPSTORAGE'
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(95,34): warning C4229: anachronism used: modifiers on data are ignored
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(95,34): error C2491: 'ReadFmtUserTypeStg': definition of dllimport data not allowed
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(95,31): error C2065: 'IN': undeclared identifier
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(95,34): error C2146: syntax error: missing ')' before identifier 'LPSTORAGE'
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(100,43): warning C4229: anachronism used: modifiers on data are ignored
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(100,43): error C2491: 'OleInitialize': definition of dllimport data not allowed
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(100,40): error C2065: 'IN': undeclared identifier
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(100,43): error C2146: syntax error: missing ')' before identifier 'LPVOID'
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(107,36): warning C4229: anachronism used: modifiers on data are ignored
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(107,36): error C2491: 'OleQueryLinkFromData': definition of dllimport data not allowed
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(107,33): error C2065: 'IN': undeclared identifier
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(107,36): error C2146: syntax error: missing ')' before identifier 'LPDATAOBJECT'
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(108,38): warning C4229: anachronism used: modifiers on data are ignored
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(108,38): error C2491: 'OleQueryCreateFromData': definition of dllimport data not allowed
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(108,35): error C2065: 'IN': undeclared identifier
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(108,38): error C2146: syntax error: missing ')' before identifier 'LPDATAOBJECT'
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(113,25): warning C4229: anachronism used: modifiers on data are ignored
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(113,25): error C2491: 'OleCreate': definition of dllimport data not allowed
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(113,22): error C2065: 'IN': undeclared identifier
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(113,25): error C2059: syntax error: 'const'
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(118,27): warning C4229: anachronism used: modifiers on data are ignored
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(118,27): error C2491: 'OleCreateEx': definition of dllimport data not allowed
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(118,24): error C2065: 'IN': undeclared identifier
1>C:\Windows Kits\10\Include\10.0.22621.0\um\Ole2.h(118,27): error C2059: syntax error: 'const'
Does this have something to do with the Windows Kit I'm using? I remember trying to do this in the past, several years ago, and ran into the same exact issue, and ended up giving up trying to catch the exception.
Can anyone point out my ignorance in this situation? Any guidance would be really appreciated.

The problem was being caused by another header include using #undef VOID, along with removing several other defines that Windows uses.
I am being forced to include comdef.h above that include to make it work, but doing that solved my problem. If anyone else runs into similar errors, make sure you include comdef.h along with other windows headers, in case some header decides to bomb the Microsoft #define 'namespace'.

Related

Xamarin | Emulator error - Device error: WARNING: unexpected '-prop' value

I've tried all ways to fix it but i can't. What should i do?
Emulator error
Device error: WARNING: unexpected '-prop' value ('monodroid.avdname=pixel_2_pie_9_0_-_api_28'), only 'qemu.' properties are supported
WARNING: unexpected '-prop' value ('emu.uuid=e8616784-3b9f-4d02-a41d-1c2254275172'), only 'qemu.' properties are supported
handleCpuAcceleration: feature check for hvf
enter image description here

Issue with Qt 4.8.6 compilation with qpa configured.

I am getting the following error when I compile qt 4.8.6 source on Mac OS X version 10.8.5.
It looks like some platform related flags are not enabled.
In file included from text/qfontengine_coretext.mm:42:
text/qfontengine_coretext_p.h:64: error: expected `)' before‘font’
text/qfontengine_coretext_p.h:65: error: expected `)' before‘font’
text/qfontengine_coretext_p.h:93: error: ‘CGContextRef’ has not
been declared
text/qfontengine_coretext_p.h:111: error: ‘CTFontRef’ does not
name a type
text/qfontengine_coretext_p.h:112: error: ‘CGFontRef’ does not
name a type
text/qfontengine_coretext_p.h:114: error: ‘CGAffineTransform’ does
not name a type
text/qfontengine_coretext_p.h:122: error: expected ‘,’ or ‘...’
before ‘&’ token
text/qfontengine_coretext_p.h:122: error: ISO C++ forbids
declaration of ‘QCFString’ with no type
text/qfontengine_coretext_p.h:123: error: expected `)' before
‘ctFontRef’
text/qfontengine_coretext_p.h:134: error: ‘CTFontRef’ does not
name a type
text/qfontengine_coretext_p.h:144: error: ‘CTFontRef’ has not been
declared
text/qfontengine_coretext_p.h:145: error: ‘CTFontRef’ does not
name a type
text/qfontengine_coretext_p.h:146: error: ISO C++ forbids
declaration of ‘QCFType’ with no type
text/qfontengine_coretext_p.h:146: error: expected ‘;’ before ‘<’
token
text/qfontengine_coretext_p.h:147: error: ‘CGAffineTransform’ does
not name a type
text/qfontengine_coretext_p.h:152: error: ‘CGAffineTransform’ does
not name a type
text/qfontengine_coretext.mm:53: error: ‘acosf’ was not declared
in this scope
text/qfontengine_coretext.mm:53: error: ‘tanf’ was not declared in
this scope
text/qfontengine_coretext.mm:55: error: variable or field
‘loadAdvancesForGlyphs’ declared void
text/qfontengine_coretext.mm:55: error: ‘CTFontRef’ was not
declared in this scope
text/qfontengine_coretext.mm:56: error: ‘CGGlyph’ was not declared
in this scope
text/qfontengine_coretext.mm:56: error: template argument 1 is
invalid
text/qfontengine_coretext.mm:56: error: ‘cgGlyphs’ was not
declared in this scope
text/qfontengine_coretext.mm:57: error: expected primary-
expression before ‘*’ token
text/qfontengine_coretext.mm:57: error: ‘glyphs’ was not declared
in this scope
text/qfontengine_coretext.mm:57: error: expected primary-
expression before ‘int’
text/qfontengine_coretext.mm:58: error: expected primary-
expression before ‘flags’
text/qfontengine_coretext.mm:59: error: expected primary-
expression before ‘const’
text/qfontengine_coretext.mm:53: warning: ‘SYNTHETIC_ITALIC_SKEW’
defined but not used
make[2]: *** [.obj/debug-shared/qfontengine_coretext.o] Error 1
make[1]: *** [debug] Error 2
make: *** [sub-gui-make_default-ordered] Error 2
Am i missing anything? The configuration command used is:
./configure -debug -opensource -confirm-license -arch "x86_64" -cocoa -qpa
and I have Xcode Mac base SDKs for 10.7 and 10.8.
QPA is Qt platform abstraction, wherein you can develop your own plugin for embedded systems. It basically replaces the platform port.
QPA is well developed in QT5, maybe you can consider using it.
You need to resolve these compilation issues on your own and if you are planning on how to use QPA, minimal plugin is the best choice.
You can resolve these issues, basically by including ApplicationService framework and header. Hope this helps.

Tests failing in GCC

I'm starting to work with GCC. I downloaded the 4.4.2_release in Mac OSX and I'm running the tests through "make check-gcc" and many tests are failing, I thought that all tests of the test suite in a stable release should pass... so I have some questions:
Is it normal? Or maybe I've done something wrong?
Is there any default configuration that I can use for all the tests pass?
Thanks,
Adding more information requested:
This is the command line I used:
make check-gcc RUNTESTFLAGS="dg.exp"
Here is the summary of the results:
=== gcc Summary ===
expected passes 9265
unexpected failures 1700
unexpected successes 6
expected failures 66
unresolved testcases 45
unsupported tests 93
Here are some examples of the tests that are failing, from log file:
FAIL: gcc.dg/20011008-1.c (test for excess errors) Excess errors:
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20011008-1.c:4: warning:
declaration does not declare anything
FAIL: gcc.dg/20011130-1.c (test for excess errors) Excess errors:
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20011130-1.c:13: error: nested
functions are disabled, use -fnested-functions to re-enable
FAIL: gcc.dg/20031223-1.c (test for errors, line 10) FAIL:
gcc.dg/20031223-1.c (test for warnings, line 10) FAIL:
gcc.dg/20031223-1.c (test for errors, line 10) FAIL:
gcc.dg/20031223-1.c (test for excess errors) Excess errors:
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20031223-1.c:10: error:
expected expression before 'int'
FAIL: gcc.dg/20041213-1.c (test for excess errors) Excess errors:
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:5: error:
conflicting types for 'foo1'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:4: error:
previous declaration of 'foo1' was here
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:8: error:
conflicting types for 'foo2'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:7: error:
previous declaration of 'foo2' was here
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:11: error:
conflicting types for 'foo3'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:10: error:
previous definition of 'foo3' was here
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:14: error:
conflicting types for 'foo4'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:13: error:
previous declaration of 'foo4' was here
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:17: warning:
conflicting types for 'foo5'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:16: warning:
previous declaration of 'foo5' was here
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:20: error:
conflicting types for 'foo6'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:19: error:
previous definition of 'foo6' was here
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:23: error:
conflicting types for 'foo7'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:22: error:
previous definition of 'foo7' was here
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:26: error:
conflicting types for 'foo8'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:25: error:
previous definition of 'foo8' was here
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:29: warning:
conflicting types for 'foo9'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:28: warning:
previous implicit declaration of 'foo9' was here
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:32: warning:
conflicting types for 'foo10'
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/20041213-1.c:31: warning:
previous implicit declaration of 'foo10' was here
FAIL: gcc.dg/Warray-bounds-3.c (test for excess errors) Excess errors:
cc1: error: unrecognized command line option "-Warray-bounds"
FAIL: gcc.dg/binary-constants-2.c (test for excess errors) Excess
errors:
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/binary-constants-2.c:12:5:
error: invalid suffix "b1101" on integer constant
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/binary-constants-2.c:15:10:
error: invalid suffix "b1101" on integer constant
FAIL: gcc.dg/boolcomplex-1.c (test for excess errors) Excess errors:
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/boolcomplex-1.c:3: error:
initializer element is not constant
FAIL: gcc.dg/builtins-30.c (test for excess errors) Excess errors:
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/builtins-30.c:10: warning:
declaration of 'cos' shadows a built-in function
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/builtins-30.c:17: warning:
declaration of 'sin' shadows a built-in function
/gcc_4_4_2_release/gcc/testsuite/gcc.dg/builtins-30.c:24: warning:
declaration of 'cosl' shadows a built-in function

Problems when make bochs on Mac OS X mountain lion

I have installed the X11 on Mac:
when I input some codes in terminal:
./configure --with-x11
make
After that, there appears some problems:
x.cc:37:22: error: X11/Xlib.h: No such file or directory
x.cc:38:23: error: X11/Xutil.h: No such file or directory
x.cc:39:21: error: X11/Xos.h: No such file or directory
x.cc:40:23: error: X11/Xatom.h: No such file or directory
x.cc:41:24: error: X11/keysym.h: No such file or directory
x.cc:42:35: error: X11/extensions/Xrandr.h: No such file or directory
x.cc:86: error: expected constructor, destructor, or type conversion before ‘*’ token
x.cc:88: error: expected initializer before ‘*’ token
x.cc:89: error: ‘Colormap’ does not name a type
x.cc:104: error: ‘Window’ does not name a type
x.cc:105: error: ‘GC’ does not name a type
x.cc:108: error: expected initializer before ‘*’ token
x.cc:136: error: ‘Pixmap’ does not name a type
x.cc:140: error: ‘Pixmap’ does not name a type
x.cc:146: error: ‘Pixmap’ does not name a type
x.cc:304: error: variable or field ‘xkeypress’ declared void
x.cc:304: error: ‘KeySym’ was not declared in this scope
x.cc:304: error: expected primary-expression before ‘int’
x.cc:326: error: ‘Colormap’ was not declared in this scope
x.cc:326: error: expected primary-expression before ‘n_tries’
x.cc:326: error: initializer expression list treated as compound expression
x.cc:326: error: expected ‘,’ or ‘;’ before ‘{’ token
Can you tell me how to solve the problems?
Use .conf.macosx instead of configure;
Open conf.macosx and add line: --with-x11;
Run:
sh .conf.macosx
Run:
make

Compile Error in using /usr/include/net/if.h

I'm trying to compile existing source code for a network sniffer on my Mac Lion. I installed libpcap. The source includes a header file /usr/include/net/if.h, which is throwing compilation errors as shown below.
Floyd:~ Shastry$ gcc -o arplisten arplisten.c -lpcap
In file included from arplisten.c:4:
/usr/include/net/if.h:265: error: field ‘ifru_addr’ has incomplete type
/usr/include/net/if.h:266: error: field ‘ifru_dstaddr’ has incomplete type
/usr/include/net/if.h:267: error: field ‘ifru_broadaddr’ has incomplete type
/usr/include/net/if.h:308: error: field ‘ifra_addr’ has incomplete type
/usr/include/net/if.h:309: error: field ‘ifra_broadaddr’ has incomplete type
/usr/include/net/if.h:310: error: field ‘ifra_mask’ has incomplete type
/usr/include/net/if.h:393: error: field ‘addr’ has incomplete type
/usr/include/net/if.h:394: error: field ‘dstaddr’ has incomplete type
arplisten.c:6:24: error: netinet/if.h: No such file or directory
arplisten.c: In function ‘main’:
arplisten.c:139: warning: incompatible implicit declaration of built-in function ‘strlen’
Floyd:~ Shastry$
I did a lot of googling for help, in vain. Can someone please help me with this?
It looks like it's the order in which files are included. See this page, which I found via google.

Resources