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

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 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 (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

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!