0

I try to compile a cpp file with this header:

#include <stdlib.h>
#include <gtk/gtk.h>

I work with MSYS2, so both the compiler and the gtk library are installed through it. The cpp compiler path is: D:\msys\usr\bin\cpp.exe

and here is the VS code include path additions, which I supplied to the IntelliSense Configurations page under "include path":

D:\msys\mingw64\include\gtk-2.0\**
D:\msys\mingw64\include\**
D:\msys\mingw64\lib\**
D:\msys\usr\include\**

and I have gtk etc. in the include folder. I actually installed three different versions of gtk, 2-4. Before I added them to the include path, I got an error like "cannot open source file", and after adding them I get the fatal error: gtk/gtk.h: No such file or directory error. gtk/gtk.h is located just inside gtk-2.0. What am I doing wrong?

Thanks a lot.

  • You need to supply those additional include paths to the compiler. – user7860670 Oct 13 '22 at 06:57
  • I did that, I edited the post now to clarify this. – ענבר מימון Oct 13 '22 at 07:02
  • Please show your compiler options. I would guess you only told VS Code where to look for the files but did not tell the compiler. – Gerhardh Oct 13 '22 at 07:05
  • "Obviously, gtk/gtk.h is located just inside gtk-2.0." Did you check where it is or what do you mean by "obviously"? – Gerhardh Oct 13 '22 at 07:05
  • You're using the wrong compiler. Most often you don't want `/usr/bin/gcc` (or `/usr/bin/cpp`). You want `/mingw64/bin/gcc`. Uninstall the `gcc` packate and install `mingw-w64-x86_64-gcc`. See [How to install MinGW-w64 and MSYS2?](https://stackoverflow.com/q/30069830/2752075). – HolyBlackCat Oct 13 '22 at 07:09
  • 1
    Again, you need to supply those additional include paths to the compiler. *"IntelliSense Configurations page"* has nothing to do with compiler, it is used for syntax highlighting. – user7860670 Oct 13 '22 at 07:10

0 Answers0