在 Windows 中获取介子项目的 Msys2 包

发布于 2025-01-17 20:41:42 字数 1413 浏览 0 评论 0原文

让我假设我想在我的C ++项目中使用curl软件包。

因此,我在系统环境中将msys2路径添加到%path%

我写了我的meson.build文件,如下所示:

project('tutorial', 'cpp')
my_dependency = dependency('curl')
executable('demo', 'main.cpp', dependencies : my_dependency)

...并使用Meson设置builddir设置Meson,但它失败了,以下错误:

The Meson build system
Version: 0.62.0
Source dir: C:\Users\woose\example
Build dir: C:\Users\woose\example\builddir
Build type: native build
Project name: tutorial
Project version: undefined
C++ compiler for the host machine: c++ (gcc 11.2.0 "c++ (Rev10, Built by MSYS2 project) 11.2.0")
C++ linker for the host machine: c++ ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: C:\msys64\mingw64\bin\pkg-config.EXE (1.8.0)
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency curl found: NO (tried pkgconfig)

meson.build:2:0: ERROR: Dependency "curl" not found, tried pkgconfig

A full log can be found at C:\Users\woose\example\builddir\meson-logs\meson-log.txt

如何解决?

Let me assume that I wanna use curl package in msys2 for my C++ project.
enter image description here

So I add msys2 path to %Path% in system environment.
enter image description here

and I write my meson.build file like below:

project('tutorial', 'cpp')
my_dependency = dependency('curl')
executable('demo', 'main.cpp', dependencies : my_dependency)

... and setup the meson with meson setup builddir but it fails with following error:

The Meson build system
Version: 0.62.0
Source dir: C:\Users\woose\example
Build dir: C:\Users\woose\example\builddir
Build type: native build
Project name: tutorial
Project version: undefined
C++ compiler for the host machine: c++ (gcc 11.2.0 "c++ (Rev10, Built by MSYS2 project) 11.2.0")
C++ linker for the host machine: c++ ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: C:\msys64\mingw64\bin\pkg-config.EXE (1.8.0)
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency curl found: NO (tried pkgconfig)

meson.build:2:0: ERROR: Dependency "curl" not found, tried pkgconfig

A full log can be found at C:\Users\woose\example\builddir\meson-logs\meson-log.txt

How can I fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

行至春深 2025-01-24 20:41:42

我修好了。另外,添加了包含目录。

project('tutorial', 'cpp')
cpp = meson.get_compiler('cpp')
my_dependency = cpp.find_library('curl', dirs: 'C:/msys64/mingw64')
cflags = include_directories('c:/msys64/mingw64/include/curl')
executable('demo', 'main.cpp', include_directories : cflags, dependencies : my_dependency)

I fixed it. plus, added include directories.

project('tutorial', 'cpp')
cpp = meson.get_compiler('cpp')
my_dependency = cpp.find_library('curl', dirs: 'C:/msys64/mingw64')
cflags = include_directories('c:/msys64/mingw64/include/curl')
executable('demo', 'main.cpp', include_directories : cflags, dependencies : my_dependency)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文