vulkan_win32.h is not "recognized" - c

I'm following this Vulkan tutorial: https://youtu.be/dHPuU-DJoBM, in particular, this video https://youtu.be/6Kj3O2Ov1RU
when I run in VS code, this errors shows (there are a lot of them, but all of the same type), i think is something with Windows implementation(?): log of VS code terminal:
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:30:5: error: unknown type name 'HINSTANCE'
HINSTANCE hinstance;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:31:5: error: unknown type name 'HWND'
HWND hwnd;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:57:5: error: unknown type name 'HANDLE'
HANDLE handle;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:58:5: error: unknown type name 'LPCWSTR'
LPCWSTR name;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:64:11: error: unknown type name 'SECURITY_ATTRIBUTES'
const SECURITY_ATTRIBUTES* pAttributes;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:65:5: error: unknown type name 'DWORD'
DWORD dwAccess;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:66:5: error: unknown type name 'LPCWSTR'
LPCWSTR name;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:82:136: error: unknown type name 'HANDLE'
...*PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* ... ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:83:135: error: unknown type name 'HANDLE'
...*PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE ha... ^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:89:5: error: unknown type name 'HANDLE'
HANDLE* pHandle);
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:94:5: error: unknown type name 'HANDLE'
HANDLE handle,
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:125:5: error: unknown type name 'HANDLE'
HANDLE handle;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:126:5: error: unknown type name 'LPCWSTR'
LPCWSTR name;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:132:11: error: unknown type name 'SECURITY_ATTRIBUTES'
const SECURITY_ATTRIBUTES* pAttributes;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:133:5: error: unknown type name 'DWORD'
DWORD dwAccess;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:134:5: error: unknown type name 'LPCWSTR'
LPCWSTR name;
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:154:142: error: unknown type name 'HANDLE'
...device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:164:5: error: unknown type name 'HANDLE'
HANDLE* pHandle);
^
C:\VulkanSDK\1.3.239.0/Include\vulkan/vulkan_win32.h:177:5: error: unknown type name 'HANDLE'
HANDLE handle;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Error:1
this is what is shown if I run vulkaninfo:
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK\1.3.239.0\Bin\VkLayer_api_dump.json invalid layer manifest file version 1.2.0. May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK\1.3.239.0\Bin\VkLayer_gfxreconstruct.json invalid layer manifest file version 1.2.0. May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK\1.3.239.0\Bin\VkLayer_khronos_synchronization2.json invalid layer manifest file version 1.2.0. May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK\1.3.239.0\Bin\VkLayer_khronos_validation.json invalid layer manifest file version 1.2.0. May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK\1.3.239.0\Bin\VkLayer_screenshot.json invalid layer manifest file version 1.2.0. May cause errors.
WARNING: [Loader Message] Code 0 : loaderAddLayerProperties: C:\VulkanSDK\1.3.239.0\Bin\VkLayer_khronos_profiles.json invalid layer manifest file version 1.2.1. May cause errors.
this is my Vulkan config:
Vulkan Instance Version: 1.2.162
Instance Extensions: count = 11
===============================
VK_EXT_debug_report : extension revision 9
VK_EXT_debug_utils : extension revision 2
VK_EXT_swapchain_colorspace : extension revision 4
VK_KHR_device_group_creation : extension revision 1
VK_KHR_external_fence_capabilities : extension revision 1
VK_KHR_external_memory_capabilities : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2 : extension revision 1
VK_KHR_surface : extension revision 25
VK_KHR_win32_surface : extension revision 6
I've tried to follow this (How to make VK_LAYER_KHRONOS_validation available?) but Windows doesn't let me delete the register
I installed the latest Vulkan SDK so it doesn't seem to be the problem. Can someone help me?

Related

Parasoft C/C++Test 9.4 , error: invalid type conversion

When I used Parasoft c/c++test9.4 with Cygwin gcc11.3 to run unit test, there is such a problem:
C++test analysis errors in /example_debug
1. Test execution: error preparing instrumentation / symbols data for file.
"/usr/lib/gcc/x86_64-pc-cygwin/11/include/mmintrin.h", line 79: error: invalid
type conversion
return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);
^
"/usr/lib/gcc/x86_64-pc-cygwin/11/include/mmintrin.h", line 161: error:
invalid type conversion
return (__m64) __builtin_ia32_packsswb ((__v4hi)__m1, (__v4hi)__m2);
^
"/usr/lib/gcc/x86_64-pc-cygwin/11/include/mmintrin.h", line 176: error:
invalid type conversion
return (__m64) __builtin_ia32_packssdw ((__v2si)__m1, (__v2si)__m2);
^
"/usr/lib/gcc/x86_64-pc-cygwin/11/include/mmintrin.h", line 191: error:
invalid type conversion
return (__m64) __builtin_ia32_packuswb ((__v4hi)__m1, (__v4hi)__m2);
^
"/usr/lib/gcc/x86_64-pc-cygwin/11/include/mmintrin.h", line 205: error:
invalid type conversion
return (__m64) __builtin_ia32_punpckhbw ((__v8qi)__m1, (__v8qi)__m2);
^
...
...
...
Compilation terminated.
Any hint on this? and how should it be done instead? Thanks in advance

unknown type name while compiling C program

I am newbie to C program and I use Linux odroid 4.9.277-122 aarch64 GNU/Linux. I compiled the C program using make PLATFORM=gcc-linux-arm BUILD=release
In my main.C it use twMessages, twMessaging, twApi header files and I got the following error.
May I know why it gives unknown type name in the header file and how can I solve the issue?
Is it related to the platform= gcc-linux-arm that I used while compiling?
In file included from ../src/twMessages.h:13,
from ../src/twMessaging.h:7,
from ../src/twApi.h:21,
from ../src/main.c:99:
../src/twInfoTable.h:88:2: error: unknown type name 'twList'
88 | twList * aspects; /**< A ::twList of the aspects associated with the entry. **/
| ^~~~~~
../src/twMessages.h:68:2: error: unknown type name 'twList'
68 | twList * headers;
| ^~~~~~
../src/twApi.h:166:2: error: unknown type name 'twList'
166 | twList * bindEventCallbackList; /**< Pointer to a ::twList of bind event callbacks. **/
| ^~~~~~
In file included from ../src/main.c:99:
../src/twApi.h:30:22: error: unknown type name 'twList'; use 'struct' keyword to refer to the type
30 | #define propertyList twList /* A propertyList is a twList */

How to include readline into a Zig project

I am trying to use readline in my Zig project.
I managed to make the linker find it by adding this to the build file:
exe.linkLibC();
exe.addIncludeDir("/usr/local/opt/readline/include");
exe.addLibPath("/usr/local/opt/readline/lib");
Even though it finds readline definitions it seems it doesn't "see" the C lib...
Error:
▶ zig build
./src/main.zig:1:18: error: C import failed
const readline = #cImport({
^
/usr/local/opt/readline/include/readline/rltypedefs.h:71:36: note: unknown type name 'FILE'
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/local/opt/readline/include/readline/readline.h:448:28: note: unknown type name 'FILE'
extern int rl_getc PARAMS((FILE *));
^
/usr/local/opt/readline/include/readline/readline.h:578:8: note: unknown type name 'FILE'
extern FILE *rl_instream;
^
/usr/local/opt/readline/include/readline/readline.h:579:8: note: unknown type name 'FILE'
extern FILE *rl_outstream;
^
/usr/local/opt/readline/include/readline/readline.h:937:3: note: unknown type name 'FILE'
FILE *inf;
^
/usr/local/opt/readline/include/readline/readline.h:938:3: note: unknown type name 'FILE'
FILE *outf;
^
zig-lua...The following command exited with error code 1:
How can I make it work?
It seems that the problem was not in the build file but in the cImport.
I was doing this:
const readline = #cImport({
#cInclude("readline/readline.h");
});
As the error message was complaining about stuff from C's stdio.h, I added that too:
const readline = #cImport({
#cInclude("stdio.h");
#cInclude("readline/readline.h");
});
And now the Zig build works.

incompatible types when assigning to type 'atomic_int' from type 'int'

src/libavcodec/h264_slice.c: In function 'ff_h264_execute_decode_slices': src/libavcodec/h264_slice.c:2757:36: error: incompatible types when assigning to type 'atomic_int' from type 'int'
sl->er.error_count = 0;
^ src/libavcodec/h264_slice.c:2781:48: error: invalid operands to binary
+ (have 'atomic_int' and 'atomic_int')
h->slice_ctx[0].er.error_count += h->slice_ctx[i].er.error_count;
^ make: *** [libavcodec/h264_slice.o] Error 1 make: *** Waiting for unfinished jobs....
I compile ffmpeg for android. whether the problem is my environment configure or source code?
I think it is source code problem. I change it as below:
sl->er.error_count = 0;
atomic_store(&sl->er.error_count, 0);
h->slice_ctx[0].er.error_count += h->slice_ctx[i].er.error_count;
atomic_fetch_add(&h->slice_ctx[0].er.error_count, atomic_load(&h->slice_ctx[i].er.error_count));

Error compiling PJSIP on Ubuntu

I am trying to compile PJSIP 2.1 with Video support on Ubuntu but I get the following error when running 'make' :
In file included from ../src/pjmedia/ffmpeg_util.c:26:0:
../src/pjmedia/ffmpeg_util.h:50:12: warning: ‘enum CodecID’ declared inside parameter list [enabled by default]
enum CodecID *codec_id);
^
../src/pjmedia/ffmpeg_util.h:50:12: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
../src/pjmedia/ffmpeg_util.h:53:7: warning: ‘enum CodecID’ declared inside parameter list [enabled by default]
pjmedia_format_id *fmt_id);
^
../src/pjmedia/ffmpeg_util.c:65:18: error: field ‘codec_id’ has incomplete type
enum CodecID codec_id;
^
../src/pjmedia/ffmpeg_util.c:167:13: error: conflicting types for ‘pjmedia_format_id_to_CodecID’
pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id,
^
In file included from ../src/pjmedia/ffmpeg_util.c:26:0:
../src/pjmedia/ffmpeg_util.h:49:13: note: previous declaration of ‘pjmedia_format_id_to_CodecID’ was here
pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id,
^
../src/pjmedia/ffmpeg_util.c: In function ‘pjmedia_format_id_to_CodecID’:
../src/pjmedia/ffmpeg_util.c:173:35: warning: comparison between pointer and integer [enabled by default]
if (t->id==fmt_id && t->codec_id != PIX_FMT_NONE) {
^
../src/pjmedia/ffmpeg_util.c:174:6: error: dereferencing pointer to incomplete type
*codec_id = t->codec_id;
^
../src/pjmedia/ffmpeg_util.c:174:6: warning: statement with no effect [-Wunused-value]
../src/pjmedia/ffmpeg_util.c:179:5: error: dereferencing pointer to incomplete type
*codec_id = PIX_FMT_NONE;
^
../src/pjmedia/ffmpeg_util.c:179:5: warning: statement with no effect [-Wunused-value]
../src/pjmedia/ffmpeg_util.c: At top level:
../src/pjmedia/ffmpeg_util.c:183:55: error: parameter 1 (‘codec_id’) has incomplete type
pj_status_t CodecID_to_pjmedia_format_id(enum CodecID codec_id,
^
make[2]: *** [output/pjmedia-i686-pc-linux-gnu/ffmpeg_util.o] Error 1
make[2]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build'
make[1]: *** [pjmedia] Error 2
make[1]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build'
make: *** [all] Error 1
I have installed the required dependencies and have no idea what the problem is. Reading the error messages it looks like it comes from error in the PJSIP code?
EDIT : I renamed enum CodecID to enum AVCodecID according to Getting “field has incomplete type” and "conflicting types" but now i'm getting the following error :
../lib/libpjmedia-codec-i686-pc-linux-gnu.a(ffmpeg_vid_codecs.o): In function `ffmpeg_codec_encode_whole.isra.7':
ffmpeg_vid_codecs.c:(.text+0x1374): undefined reference to `avcodec_encode_video2'
collect2: error: ld returned 1 exit status
make[2]: *** [../bin/pjmedia-test-i686-pc-linux-gnu] Error 1
make[2]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build'
make[1]: *** [pjmedia-test] Error 2
make[1]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build'
make: *** [all] Error 1
Seems that you miss libavcodec/avcodec.h and, most probably, also libavformat/avformat.h. This should be because ffmpeg include folder is not into gcc's list of directories to look for header files.
From your update seems that pjsip is building against a newer ffmpeg version that the one available in Ubuntu's repositories. As you've built it yourself, you can configure pjsip to use your version by running:
./configure --with-ffmpeg=<YOUR_FFMPEG_FOLDER>
or
#Copy all library ffmpeg library files into one folder
CFLAGS="-I<YOUR_FFMPEG_FOLDER>" LDFLAGS="-L<YOUR_FFMPEG_LIB_FOLDER>" ./configure
The answer to the original question :
While compiling PJSIP I find that CodecID enum has been deprecated from ffmpeg. However it's been replaced by AV_CodecID and also the enum values have a leading AV_ added to them.
Thus after changing CodecID to AV_CodecID, please change the enums in ffmpeg_util.c.
For example this is what the table looks like after the change :
/* Conversion table between pjmedia_format_id and CodecID */
static const struct ffmpeg_codec_table_t
{
pjmedia_format_id id;
enum AVCodecID codec_id;
} ffmpeg_codec_table[] =
{
{PJMEDIA_FORMAT_H261, AV_CODEC_ID_H261},
{PJMEDIA_FORMAT_H263, AV_CODEC_ID_H263},
{PJMEDIA_FORMAT_H263P, AV_CODEC_ID_H263P},
{PJMEDIA_FORMAT_H264, AV_CODEC_ID_H264},
{PJMEDIA_FORMAT_MPEG1VIDEO, AV_CODEC_ID_MPEG1VIDEO},
{PJMEDIA_FORMAT_MPEG2VIDEO, AV_CODEC_ID_MPEG2VIDEO},
{PJMEDIA_FORMAT_MPEG4, AV_CODEC_ID_MPEG4},
{PJMEDIA_FORMAT_MJPEG, AV_CODEC_ID_MJPEG}
};

Resources