【问题标题】:GTK+ with Visual Studio 2019GTK+ 与 Visual Studio 2019
【发布时间】:2020-12-27 15:23:31
【问题描述】:

我正在尝试在 Windows 10 上安装 GTK project,并将其与 Visual Studio 集成以使用 C 构建应用程序。

在关注他们的tutorial on installation之后,我发现自己在第5步成功,但是当我打开visual studio尝试编译“hello world”类型代码时,它无法识别标题

#include <gtk/gtk.h>

并吐出错误

Error   LNK2019 unresolved external symbol 
gtk_window_set_child referenced in function activate

Error   LNK1120 1 unresolved externals  test    

所以我回到this 页面并按照“使用 MSYS2 包中的 GTK”部分进行操作,同样,没有雪茄。

我按照these instructions 继续执行这些步骤,虽然 IDE 现在可以识别标题并自动完成,但似乎我仍然做错了什么......

来自控制台的错误是(在尝试了几种执行代码的方法之后)

D:\CDev\test>gcc -o test test.c `pkg-config --cflags --libs 
gtk4`
gcc: error: `pkg-config: No such file or directory
gcc: error: gtk4`: No such file or directory
gcc: error: unrecognized command-line option '--cflags'
gcc: error: unrecognized command-line option '--libs'

D:\CDev\test>gcc test.c
test.c:1:10: fatal error: gtk/gtk.h: No such file or 
  directory
     1 | #include <gtk/gtk.h>

有人有什么想法吗?

我想知道这是否相关......

{
   "cmake.configureSettings": {
     "CMAKE_TOOLCHAIN_FILE": "[vcpkg root]/scripts/buildsystems/vcpkg.cmake"
    }
}

但我犹豫是否开始搞乱 cmake

【问题讨论】:

    标签: c visual-studio cmd gtk gtk3


    【解决方案1】:

    记住:

    `
    

    而不是

    '
    

    在 cmd 中。

    如果您看到此页面,请使用此documentation

    【讨论】:

      猜你喜欢
      • 2021-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-17
      • 1970-01-01
      相关资源
      最近更新 更多