You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote the C codes of the real-time video inference using OPENVino.
I includes <openvino/c/openvino.h> in many files,
and I get the build-errors of the multiple declaration of global variables.
I found that the cause of errors. (And I have avoided the errors at my side)
Global variables in API are declared without "extern" when using C compiler.
src/bindings/c/include/openvino/c/ov_common.h,
WITH C compiler, not static library, and LINUX,
line 36, # define OPENVINO_C_API_EXTERN
line 56, # define OPENVINO_C_VAR(...) OPENVINO_C_API_EXTERN attribute((visibility("default"))) VA_ARGS
WITH C compiler, global variables in API shall be defined with "extern".
So, how about modifying the ov_common.h like the below?
ilya-lavrenov
changed the title
[Bug]: build-errors of multiple declaration of global variables when including multiple "openvino.h"
[Bug] [C-API]: build-errors of multiple declaration of global variables when including multiple "openvino.h"
Feb 4, 2025
OpenVINO Version
Master branch
Operating System
Ubuntu 20.04 (LTS)
Device used for inference
GPU
Framework
None
Model used
No response
Issue description
I wrote the C codes of the real-time video inference using OPENVino.
I includes <openvino/c/openvino.h> in many files,
and I get the build-errors of the multiple declaration of global variables.
I found that the cause of errors. (And I have avoided the errors at my side)
Global variables in API are declared without "extern" when using C compiler.
src/bindings/c/include/openvino/c/ov_common.h,
WITH C compiler, not static library, and LINUX,
WITH C compiler, global variables in API shall be defined with "extern".
So, how about modifying the ov_common.h like the below?
#ifdef __cplusplus
#define OPENVINO_C_VAR_EXTERN extern "C"
#else
#define OPENVINO_C_VAR_EXTERN extern
#endif
...
#define OPENVINO_C_VAR(...) OPENVINO_C_VAR_EXTERN ... ... ...
Step-by-step reproduction
No response
Relevant log output
Issue submission checklist
The text was updated successfully, but these errors were encountered: