# Problem setting up arv.h with Visual Studio 2022 (C/C++)

**URL:** <https://aravis-project.discourse.group/t/problem-setting-up-arv-h-with-visual-studio-2022-c-c/565>\
**Category:** Using Aravis\
**Created:** [January 23, 2023, 9:42am UTC](https://aravis-project.discourse.group/t/problem-setting-up-arv-h-with-visual-studio-2022-c-c/565 "2023-01-23T09:42:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeus](https://avatars.discourse-cdn.com/v4/letter/z/a4c791/32.png) [@zeus](https://aravis-project.discourse.group/u/zeus)\
**Post date:** [January 23, 2023, 9:42am UTC](https://aravis-project.discourse.group/t/problem-setting-up-arv-h-with-visual-studio-2022-c-c/565/1 "2023-01-23T09:42:10Z")

</div>

Hello,

I m trying to use the Aravis lib with Visual Studio 2022 (C/C++), but I can’t find a way to include the arv.h without any error (see screenshots below).

For this project, I have one constraint on the development machine, no direct connection to the internet, but I can transfer files threw USB. The installation with the Conan [script](https://github.com/AravisProject/aravis/blob/main/.github/workflows/aravis-msvc.yml) seems impossible (I didn’t find a way to install it offline).

How did I install Aravis?

- I have used the msys2 package compiled on another computer connected to the internet. I then copied the msys2/ming64/include for Aravis headers and the msys2/ming64/bin for Aravis DLLs and executable. The imported Aravis test executable works fine on the development machine.
- I installed glib threw NuGet and did a basic HelloWorld to test it. Glib seems to be installed correctly since the HelloWorld work. (Problem comes when adding the “#include \<arv.h\>”)
- My project configuration:  
- project parameter \> C/C++ \> Additional include directory → “lib/Glib23/include”(glibconfig.h) and “msys64/ming64/include/aravis-0.8”  
- project parameter \>linker \> Additional librairie directory → “msys64/ming64/bin”  
- Compiling for windows x64

I tried using C and C++ compilation both don’t work. I have no idea what I did wrong.

For my system specification:

Windows 10 20h2 x64

- Visual Studio Professional 2022 17.3.4
- NuGet pkg: [glib 2.36.2.11](https://www.nuget.org/packages/glib) (and all the dependencies)
- arvversion.h aravavis : 0.8.22 and API : 0.8

PS: Since I m from France the errors are in french here is a translation :  
C2065 “X” identifier is undeclared  
C2086 “X” redefinition  
C2143 syntax error : missing ‘;’ before ‘X’  
C2144 syntax error : ‘X’ must be preceded by ‘;’  
C2146 syntax error : missing ‘;’ before the identifier ‘X’  
C2172 \<\< X \>\> the use of “X” is not valid  
C2199 syntax error : found ‘identifier (’ at global scope (was a declaration intended?)  
C2374 ‘X’ : redefinition; multiple initialization

 ![error1](https://global.discourse-cdn.com/free1/uploads/aravis_project/original/1X/83637852a22fdf25e96075c70148a63968c38263.png)

---

<div class="post-metadata">

**Author:** ![zeus](https://avatars.discourse-cdn.com/v4/letter/z/a4c791/32.png) [@zeus](https://aravis-project.discourse.group/u/zeus)\
**Post date:** [January 23, 2023, 9:42am UTC](https://aravis-project.discourse.group/t/problem-setting-up-arv-h-with-visual-studio-2022-c-c/565/2 "2023-01-23T09:42:43Z")

</div>

![error2](https://global.discourse-cdn.com/free1/uploads/aravis_project/original/1X/39b44b3b364efa8eb6f1b000bddf6d0c06eb44a9.png)

---

<div class="post-metadata">

**Author:** ![venusspace](https://yyz2.discourse-cdn.com/free1/user_avatar/aravis-project.discourse.group/venusspace/32/282_2.png) [@venusspace](https://aravis-project.discourse.group/u/venusspace)\
**Post date:** [March 7, 2024, 5:38am UTC](https://aravis-project.discourse.group/t/problem-setting-up-arv-h-with-visual-studio-2022-c-c/565/3 "2024-03-07T05:38:40Z")

</div>

I have the same problem as you, the reason is the file named arvapi.h, There is a line of code that looks like this  
“#define ARV\_API extern **attribute** ((visibility (“default”))) ”.  
**attribute** is specific to the GCC compiler, you need to change this part to  
" #ifdef \_\_ GNUC\_\_  
#define ARV\_API extern **attribute** ((visibility (“default”)))  
#else  
#define ARV\_API extern  
#endif "  
and you won’t get any errors!
