本文介绍了无法在Windows 10上编译Cairo C代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows 10上使用行的邮政编码。 https://www.gtk.org/download/windows.php rel = nofollow noreferrer> msys64 。

I am trying to compile the zetcode lines on Windows 10 using msys64.

我使用以下编译命令:

gcc example.c -o example `pkg-config --cflags --libs cairo gtk+-3.0`

并获取以下错误:

-bash: pkg-config: command not found
example.c:1:19: fatal error: cairo.h: No such file or directory
 #include <cairo.h>

但是我之前做过 pacman -S mingw-w64-i686-cairo 并且安装成功。当我输入** pacman -Ss mingw-w64-i686-cairo
**时,我得到以下信息:

However I did pacman -S mingw-w64-i686-cairo before and the installation was successful. When I type **pacman -Ss mingw-w64-i686-cairo** I get the following:

mingw32/mingw-w64-i686-cairo 1.15.2-4 [installed]
    Cairo vector graphics library (mingw-w64)

当我运行 gcc -v 时,我得到:

使用内置规格。
COLLECT_GCC = gcc
COLLECT_LTO_WRAPPER = / usr / lib / gcc / x86_64-pc-msys / 5.3.0 / lto-wrapper.exe
目标:x86_64-pc-msys
使用以下命令配置:/msys_scripts/gcc/src/gcc-5.3.0/configure --build = x86_64-pc-msys --prefix = / usrable-static --enable-version-specific-runtime-libs --with-arch = x86-64 --with-tune =泛型--diso --enable-graphite --enable-threads = posix --enable-libatomic --enable-libcilkrts --enable-libg --disable-win32-registry-禁用符号--with-gnu-ld --with-gnu-as --disable-isl-version-cith-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi = gcc4 -compatible
线程模型:posix
gcc版本5.3.0(GCC)

Using built-in specs.COLLECT_GCC=gccCOLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-msys/5.3.0/lto-wrapper.exeTarget: x86_64-pc-msysConfigured with: /msys_scripts/gcc/src/gcc-5.3.0/configure --build=x86_64-pc-msys --prefix=/usrable-static --enable-version-specific-runtime-libs --with-arch=x86-64 --with-tune=generic --diso --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libg --disable-win32-registry --disable-symvers --with-gnu-ld --with-gnu-as --disable-isl-version-cith-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatibleThread model: posixgcc version 5.3.0 (GCC)

最后但并非最不重要的,如果我遵循此说明网站我可以编译代码。但是,提供的GTK3版本非常旧,无法运行更新的。

Last but not least, If I follow the instruction on this website I can compile the lines code. However, GTK3 version provided is very old and cannot run newer code.

到Cairo.h的路径是:

The paths to Cairo.h are:

C:\MinGW\include\cairo已过时(但有效)的GTK + 3安装

C:\MinGW\include\cairo for the outdated (but working) GTK+3 install

C:\msys64\mingw32\ \include\cairo

C:\msys64\mingw32\include\cairo

C:\msys64\mingw64\include\cairo对于使用msys64进行更新(但不起作用)的GTK3安装

C:\msys64\mingw64\include\cairo for the newer (but not working) GTK3 install using msys64

MSYS64试图在哪个目录中查找开罗库?

Which directory is MSYS64 trying to find the Cairo library?

推荐答案

您显示了两条消息。第二和第三行来自编译器。第一行来自shell。第一个错误导致了第二个错误。它表示 pkg-config 命令不存在。您需要安装其软件包。使用此命令(它也会安装其他有用的软件包):

You showed two messages. Lines two and three came from the compiler. The first line came from the shell. That first bug caused the second bug. It says that the pkg-config command doesn't exist. You need to install its package. Use this command (it installs other useful packages, too):

pacboy sync base-devel

(您无需在 cairo > pkg-config 命令; gtk + -3.0 命名所需的软件包。)

(You don't need to name cairo in the pkg-config command; gtk+-3.0 names the packages that it needs.)

这篇关于无法在Windows 10上编译Cairo C代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 09:14