MSYS2のMINGW64 → pacman やOpenGL関連ライブラリがインストール可能 な環境でGLSLを描画できた。

bash: pacman: command not found

ChatGPT said:

なるほど、そのメッセージは**MSYS2のMINGW64ではなく、単体のGit Bash(MINGW64)**を使っていることを示しています。
Git Bash の MINGW64 環境は 名前に「MINGW64」と付いていても、MSYS2 とは別物であり、pacman などのパッケージマネージャーは含まれていません。


✅ 何が起きているかまとめ

  • Git BashのMINGW64pacman や開発用ライブラリなし
  • MSYS2のMINGW64pacman やOpenGL関連ライブラリがインストール可能

🔄 解決方法:MSYS2の導入

GLSLやOpenGLを本格的に使いたい場合、MSYS2を導入するのが一番簡単かつ強力です。

1. MSYS2をダウンロード・インストール

MSYS2公式サイト からインストーラーをダウンロードしてインストールします。

MSYS2 は「Windows 向けソフトウェア配布および構築プラットフォーム」です。

しょぼいウィルスソフトが反応する可能性があるので切っておく

  1. プロジェクトのコンパイルを開始するには、mingw-w64 GCCなどのツールをインストールする必要があるでしょう。以下のコマンドを実行してください。
pacman -S mingw-w64-ucrt-x86_64-gcc
  1. ターミナルウィンドウに以下の出力が表示されます。「Enter」キーを押して続行してください。

furcr@furcraea_built UCRT64 ~
$ pacman -S mingw-w64-ucrt-x86_64-gcc
resolving dependencies...
looking for conflicting packages...

Packages (16) mingw-w64-ucrt-x86_64-binutils-2.44-4
              mingw-w64-ucrt-x86_64-crt-git-13.0.0.r21.gf5469ff36-1
              mingw-w64-ucrt-x86_64-gcc-libs-15.1.0-5  mingw-w64-ucrt-x86_64-gettext-runtime-0.25-1
              mingw-w64-ucrt-x86_64-gmp-6.3.0-2
              mingw-w64-ucrt-x86_64-headers-git-13.0.0.r21.gf5469ff36-1
              mingw-w64-ucrt-x86_64-isl-0.27-1  mingw-w64-ucrt-x86_64-libiconv-1.18-1
              mingw-w64-ucrt-x86_64-libwinpthread-13.0.0.r21.gf5469ff36-1
              mingw-w64-ucrt-x86_64-mpc-1.3.1-2  mingw-w64-ucrt-x86_64-mpfr-4.2.2-1
              mingw-w64-ucrt-x86_64-windows-default-manifest-6.4-4
              mingw-w64-ucrt-x86_64-winpthreads-13.0.0.r21.gf5469ff36-1
              mingw-w64-ucrt-x86_64-zlib-1.3.1-1  mingw-w64-ucrt-x86_64-zstd-1.5.7-1
              mingw-w64-ucrt-x86_64-gcc-15.1.0-5

Total Download Size:    69.02 MiB
Total Installed Size:  540.65 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages...
 mingw-w64-ucrt-x86_64-crt-...     4.6 MiB  1740 KiB/s 00:03 [###############################] 100%
 mingw-w64-ucrt-x86_64-isl-...  1453.5 KiB   502 KiB/s 00:03 [###############################] 100%
 mingw-w64-ucrt-x86_64-binu...     6.0 MiB  1980 KiB/s 00:03 [###############################] 100%
 mingw-w64-ucrt-x86_64-gcc-...  1043.5 KiB  2.24 MiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-libi...   725.4 KiB  1656 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-head...     6.4 MiB  1811 KiB/s 00:04 [###############################] 100%
 mingw-w64-ucrt-x86_64-gmp-...   578.5 KiB  1297 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-mpfr...   541.9 KiB  1234 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-gett...   333.5 KiB   836 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-gcc-...    46.6 MiB  11.1 MiB/s 00:04 [###############################] 100%
 mingw-w64-ucrt-x86_64-zstd...   642.3 KiB   605 KiB/s 00:01 [###############################] 100%
 mingw-w64-ucrt-x86_64-mpc-...   128.3 KiB   276 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-zlib...    92.1 KiB   242 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-winp...    41.8 KiB   109 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-libw...    29.5 KiB  79.2 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-wind...     3.0 KiB  5.10 KiB/s 00:01 [###############################] 100%
 Total (16/16)                    69.0 MiB  12.9 MiB/s 00:05 [###############################] 100%
(16/16) checking keys in keyring                             [###############################] 100%
(16/16) checking package integrity                           [###############################] 100%
(16/16) loading package files                                [###############################] 100%
(16/16) checking for file conflicts                          [###############################] 100%
(16/16) checking available disk space                        [###############################] 100%
:: Processing package changes...
( 1/16) installing mingw-w64-ucrt-x86_64-libwinpthread       [###############################] 100%
( 2/16) installing mingw-w64-ucrt-x86_64-gcc-libs            [###############################] 100%
( 3/16) installing mingw-w64-ucrt-x86_64-libiconv            [###############################] 100%
( 4/16) installing mingw-w64-ucrt-x86_64-gettext-runtime     [###############################] 100%
( 5/16) installing mingw-w64-ucrt-x86_64-zlib                [###############################] 100%
( 6/16) installing mingw-w64-ucrt-x86_64-zstd                [###############################] 100%
( 7/16) installing mingw-w64-ucrt-x86_64-binutils            [###############################] 100%
( 8/16) installing mingw-w64-ucrt-x86_64-headers-git         [###############################] 100%
( 9/16) installing mingw-w64-ucrt-x86_64-crt-git             [###############################] 100%
(10/16) installing mingw-w64-ucrt-x86_64-gmp                 [###############################] 100%
(11/16) installing mingw-w64-ucrt-x86_64-isl                 [###############################] 100%
(12/16) installing mingw-w64-ucrt-x86_64-mpfr                [###############################] 100%
(13/16) installing mingw-w64-ucrt-x86_64-mpc                 [###############################] 100%
(14/16) installing mingw-w64-ucrt-x86_64-windows-default...  [###############################] 100%
(15/16) installing mingw-w64-ucrt-x86_64-winpthreads         [###############################] 100%
(16/16) installing mingw-w64-ucrt-x86_64-gcc                 [###############################] 100%

furcr@furcraea_built UCRT64 ~
$

gccこれで、Windows 用のソフトウェアをビルドするために
呼び出すことができます。

gcc --version
gcc.exe (Rev5, Built by MSYS2 project) 15.1.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


furcr@furcraea_built UCRT64 ~
$

MSYS2 をインストールすると、 経由で自動的に更新されます。
詳細については、
更新ガイドを
pacman参照してください。

2. シェルの選択(重要)

インストール後、以下のいずれかのターミナルを起動:

  • MSYS2 MinGW 64-bit(おすすめ)
    /mingw64/bin 環境になり、pacmanも使える

開発ツールとライブラリのインストール

pacman -Syu   # はじめに全体アップデート


furcr@furcraea_built MINGW64 ~
$ pacman -Syu
:: Synchronizing package databases...
 clangarm64 is up to date
 mingw32 is up to date
 mingw64 is up to date
 ucrt64 is up to date
 clang64 is up to date
 msys is up to date
:: Starting core system upgrade...
 there is nothing to do
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Packages (19) curl-8.14.1-2  gcc-libs-15.1.0-2  libcurl-8.14.1-2  libffi-3.5.1-1
              libhogweed-3.10.2-1  libnettle-3.10.2-1  libnghttp3-1.10.1-1  libngtcp2-1.13.0-2
              libopenssl-3.5.1-1  libsqlite-3.50.2-1
              mingw-w64-ucrt-x86_64-crt-git-13.0.0.r57.gc1a7f831b-1
              mingw-w64-ucrt-x86_64-gcc-15.1.0-6  mingw-w64-ucrt-x86_64-gcc-libs-15.1.0-6
              mingw-w64-ucrt-x86_64-gettext-runtime-0.25.1-1
              mingw-w64-ucrt-x86_64-headers-git-13.0.0.r57.gc1a7f831b-1
              mingw-w64-ucrt-x86_64-libwinpthread-13.0.0.r57.gc1a7f831b-1
              mingw-w64-ucrt-x86_64-winpthreads-13.0.0.r57.gc1a7f831b-1  nettle-3.10.2-1
              openssl-3.5.1-1

Total Download Size:    65.09 MiB
Total Installed Size:  489.36 MiB
Net Upgrade Size:        1.06 MiB

:: Proceed with installation? [Y/n]

必要なライブラリ

pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw mingw-w64-x86_64-glew mingw-w64-x86_64-glm

furcr@furcraea_built MINGW64 ~
$ pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw mingw-w64-x86_64-glew mingw-w64-x86_64-glm
:: There are 13 members in group mingw-w64-x86_64-toolchain:
:: Repository mingw64
   1) mingw-w64-x86_64-binutils  2) mingw-w64-x86_64-crt-git  3) mingw-w64-x86_64-gcc
   4) mingw-w64-x86_64-gdb  5) mingw-w64-x86_64-gdb-multiarch  6) mingw-w64-x86_64-headers-git
   7) mingw-w64-x86_64-libmangle-git  8) mingw-w64-x86_64-libwinpthread  9) mingw-w64-x86_64-make
   10) mingw-w64-x86_64-pkgconf  11) mingw-w64-x86_64-tools-git  12) mingw-w64-x86_64-winpthreads
   13) mingw-w64-x86_64-winstorecompat-git

Enter a selection (default=all):そのまま Enter キーを押す(default=all)

resolving dependencies...
looking for conflicting packages...

Packages (43) mingw-w64-x86_64-bzip2-1.0.8-3  mingw-w64-x86_64-expat-2.7.1-2
              mingw-w64-x86_64-gcc-libs-15.1.0-6  mingw-w64-x86_64-gettext-runtime-0.25.1-1
              mingw-w64-x86_64-gmp-6.3.0-2  mingw-w64-x86_64-isl-0.27-1
              mingw-w64-x86_64-libffi-3.5.1-1  mingw-w64-x86_64-libiconv-1.18-1
              mingw-w64-x86_64-libsystre-1.0.2-1  mingw-w64-x86_64-libtre-0.9.0-1
              mingw-w64-x86_64-mpc-1.3.1-2  mingw-w64-x86_64-mpdecimal-4.0.1-1
              mingw-w64-x86_64-mpfr-4.2.2-1  mingw-w64-x86_64-ncurses-6.5.20241228-3
              mingw-w64-x86_64-openssl-3.5.1-1  mingw-w64-x86_64-python-3.12.11-1
              mingw-w64-x86_64-readline-8.2.013-1  mingw-w64-x86_64-sqlite3-3.50.2-1
              mingw-w64-x86_64-tcl-8.6.16-1  mingw-w64-x86_64-termcap-1.3.1-7
              mingw-w64-x86_64-tk-8.6.16-1  mingw-w64-x86_64-tzdata-2025b-2
              mingw-w64-x86_64-windows-default-manifest-6.4-4  mingw-w64-x86_64-xxhash-0.8.3-1
              mingw-w64-x86_64-xz-5.8.1-2  mingw-w64-x86_64-zlib-1.3.1-1
              mingw-w64-x86_64-zstd-1.5.7-1  mingw-w64-x86_64-binutils-2.44-4
              mingw-w64-x86_64-crt-git-13.0.0.r57.gc1a7f831b-1  mingw-w64-x86_64-gcc-15.1.0-6
              mingw-w64-x86_64-gdb-16.3-1  mingw-w64-x86_64-gdb-multiarch-16.3-1
              mingw-w64-x86_64-glew-2.2.0-3  mingw-w64-x86_64-glfw-3.4-1
              mingw-w64-x86_64-glm-1.0.1-1  mingw-w64-x86_64-headers-git-13.0.0.r57.gc1a7f831b-1
              mingw-w64-x86_64-libmangle-git-13.0.0.r57.gc1a7f831b-1
              mingw-w64-x86_64-libwinpthread-13.0.0.r57.gc1a7f831b-1  mingw-w64-x86_64-make-4.4.1-3
              mingw-w64-x86_64-pkgconf-1~2.5.1-1
              mingw-w64-x86_64-tools-git-13.0.0.r57.gc1a7f831b-1
              mingw-w64-x86_64-winpthreads-13.0.0.r57.gc1a7f831b-1
              mingw-w64-x86_64-winstorecompat-git-13.0.0.r57.gc1a7f831b-1

Total Download Size:   126.25 MiB
Total Installed Size:  918.18 MiB

:: Proceed with installation? [Y/n] そのまま Enter キーを押す
:: Retrieving packages...
 mingw-w64-x86_64-gdb-multi...     6.4 MiB  2.83 MiB/s 00:02 [###############################] 100%
 mingw-w64-x86_64-headers-g...     6.4 MiB  2.55 MiB/s 00:02 [###############################] 100%
 mingw-w64-x86_64-openssl-3...     7.9 MiB  3.04 MiB/s 00:03 [###############################] 100%
 mingw-w64-x86_64-binutils-...     6.0 MiB  9.99 MiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-python-3....    23.2 MiB  7.71 MiB/s 00:03 [###############################] 100%
 mingw-w64-x86_64-gcc-15.1....    46.6 MiB  14.2 MiB/s 00:03 [###############################] 100%
 mingw-w64-x86_64-gdb-16.3-...     4.6 MiB  5.62 MiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-glm-1.0.1...     3.4 MiB  6.33 MiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-tcl-8.6.1...     2.7 MiB  5.43 MiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-crt-git-1...     4.5 MiB  4.20 MiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-sqlite3-3...     2.3 MiB  4.55 MiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-tk-8.6.16...     2.0 MiB  4.29 MiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-ncurses-6...  1747.4 KiB  3.53 MiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-isl-0.27-...  1456.4 KiB  2.96 MiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-gcc-libs-...  1044.6 KiB  2.11 MiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libiconv-...   726.4 KiB  1897 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-glew-2.2....   635.3 KiB  1390 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-zstd-1.5....   642.7 KiB  1060 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-gmp-6.3.0...   577.8 KiB  1201 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-mpfr-4.2....   542.5 KiB  1203 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-xz-5.8.1-...   474.4 KiB   892 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-readline-...   411.7 KiB   907 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-gettext-r...   335.2 KiB   685 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-tools-git...   323.2 KiB   710 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-tzdata-20...   221.2 KiB   643 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-glfw-3.4-...   177.0 KiB   501 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-mpdecimal...   155.8 KiB   449 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-expat-2.7...   165.9 KiB   384 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-xxhash-0....   119.2 KiB   341 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-make-4.4....   138.5 KiB   287 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-mpc-1.3.1...   128.7 KiB   245 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-zlib-1.3....   104.4 KiB   236 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-pkgconf-1...   100.1 KiB   212 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-bzip2-1.0...    90.9 KiB   188 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libffi-3....    43.2 KiB   119 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libtre-0....    79.5 KiB   165 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-winpthrea...    41.9 KiB   119 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libwinpth...    30.2 KiB  69.5 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-termcap-1...    27.3 KiB  71.6 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-winstorec...    25.0 KiB  71.4 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libmangle...    22.8 KiB  57.4 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libsystre...     9.7 KiB  27.3 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-windows-d...     3.1 KiB  5.74 KiB/s 00:01 [###############################] 100%
 Total (43/43)                   126.3 MiB  16.3 MiB/s 00:08 [###############################] 100%
(43/43) checking keys in keyring                             [###############################] 100%
(43/43) checking package integrity                           [###############################] 100%
(43/43) loading package files                                [###############################] 100%
(43/43) checking for file conflicts                          [###############################] 100%
(43/43) checking available disk space                        [###############################] 100%
:: Processing package changes...
( 1/43) installing mingw-w64-x86_64-libwinpthread            [###############################] 100%
( 2/43) installing mingw-w64-x86_64-gcc-libs                 [###############################] 100%
( 3/43) installing mingw-w64-x86_64-libiconv                 [###############################] 100%
( 4/43) installing mingw-w64-x86_64-gettext-runtime          [###############################] 100%
( 5/43) installing mingw-w64-x86_64-zlib                     [###############################] 100%
( 6/43) installing mingw-w64-x86_64-zstd                     [###############################] 100%
( 7/43) installing mingw-w64-x86_64-binutils                 [###############################] 100%
( 8/43) installing mingw-w64-x86_64-headers-git              [###############################] 100%
( 9/43) installing mingw-w64-x86_64-crt-git                  [###############################] 100%
(10/43) installing mingw-w64-x86_64-gmp                      [###############################] 100%
(11/43) installing mingw-w64-x86_64-isl                      [###############################] 100%
(12/43) installing mingw-w64-x86_64-mpfr                     [###############################] 100%
(13/43) installing mingw-w64-x86_64-mpc                      [###############################] 100%
(14/43) installing mingw-w64-x86_64-windows-default-manifest [###############################] 100%
(15/43) installing mingw-w64-x86_64-winpthreads              [###############################] 100%
(16/43) installing mingw-w64-x86_64-gcc                      [###############################] 100%
(17/43) installing mingw-w64-x86_64-expat                    [###############################] 100%
(18/43) installing mingw-w64-x86_64-libtre                   [###############################] 100%
(19/43) installing mingw-w64-x86_64-libsystre                [###############################] 100%
(20/43) installing mingw-w64-x86_64-ncurses                  [###############################] 100%
(21/43) installing mingw-w64-x86_64-bzip2                    [###############################] 100%
(22/43) installing mingw-w64-x86_64-libffi                   [###############################] 100%
(23/43) installing mingw-w64-x86_64-mpdecimal                [###############################] 100%
(24/43) installing mingw-w64-x86_64-openssl                  [###############################] 100%
Optional dependencies for mingw-w64-x86_64-openssl
    mingw-w64-x86_64-ca-certificates
(25/43) installing mingw-w64-x86_64-termcap                  [###############################] 100%
(26/43) installing mingw-w64-x86_64-readline                 [###############################] 100%
(27/43) installing mingw-w64-x86_64-sqlite3                  [###############################] 100%
Optional dependencies for mingw-w64-x86_64-sqlite3
    mingw-w64-x86_64-tcl: for sqlite3_analyzer [pending]
(28/43) installing mingw-w64-x86_64-tcl                      [###############################] 100%
(29/43) installing mingw-w64-x86_64-tk                       [###############################] 100%
(30/43) installing mingw-w64-x86_64-xz                       [###############################] 100%
(31/43) installing mingw-w64-x86_64-tzdata                   [###############################] 100%
(32/43) installing mingw-w64-x86_64-python                   [###############################] 100%
(33/43) installing mingw-w64-x86_64-xxhash                   [###############################] 100%
(34/43) installing mingw-w64-x86_64-gdb                      [###############################] 100%
Optional dependencies for mingw-w64-x86_64-gdb
    mingw-w64-x86_64-python-pygments: for syntax highlighting
(35/43) installing mingw-w64-x86_64-gdb-multiarch            [###############################] 100%
Optional dependencies for mingw-w64-x86_64-gdb-multiarch
    mingw-w64-x86_64-python-pygments: for syntax highlighting
(36/43) installing mingw-w64-x86_64-libmangle-git            [###############################] 100%
(37/43) installing mingw-w64-x86_64-make                     [###############################] 100%
(38/43) installing mingw-w64-x86_64-pkgconf                  [###############################] 100%
(39/43) installing mingw-w64-x86_64-tools-git                [###############################] 100%
(40/43) installing mingw-w64-x86_64-winstorecompat-git       [###############################] 100%
(41/43) installing mingw-w64-x86_64-glfw                     [###############################] 100%
(42/43) installing mingw-w64-x86_64-glew                     [###############################] 100%
(43/43) installing mingw-w64-x86_64-glm                      [###############################] 100%

furcr@furcraea_built MINGW64 ~
$

完了したら GLSL 含む OpenGL プログラムのビルドが可能に

プロジェクト構成

glsl_sample/
├── CMakeLists.txt
├── main.c
├── shader.vert
└── shader.frag

🔧 main.c(OpenGLでGLSL読み込んで三角形描画)

#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>

// ファイル読み込みヘルパー
char* load_shader_source(const char* filepath) {
    FILE* file = fopen(filepath, "rb");
    if (!file) {
        fprintf(stderr, "Failed to open %s\n", filepath);
        exit(1);
    }
    fseek(file, 0, SEEK_END);
    long len = ftell(file);
    rewind(file);
    char* buffer = (char*)malloc(len + 1);
    fread(buffer, 1, len, file);
    buffer[len] = '\0';
    fclose(file);
    return buffer;
}

GLuint compile_shader(GLenum type, const char* source) {
    GLuint shader = glCreateShader(type);
    glShaderSource(shader, 1, &source, NULL);
    glCompileShader(shader);
    GLint success;
    glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
    if (!success) {
        char infoLog[512];
        glGetShaderInfoLog(shader, 512, NULL, infoLog);
        fprintf(stderr, "Shader compile error: %s\n", infoLog);
        exit(1);
    }
    return shader;
}

int main() {
    if (!glfwInit()) {
        fprintf(stderr, "GLFW init failed\n");
        return -1;
    }

    GLFWwindow* window = glfwCreateWindow(800, 600, "GLSL Sample", NULL, NULL);
    if (!window) {
        glfwTerminate();
        return -1;
    }
    glfwMakeContextCurrent(window);
    glewInit();

    char* vertexSource = load_shader_source("../shader.vert");
    char* fragmentSource = load_shader_source("../shader.frag");

    GLuint vertexShader = compile_shader(GL_VERTEX_SHADER, vertexSource);
    GLuint fragmentShader = compile_shader(GL_FRAGMENT_SHADER, fragmentSource);

    GLuint shaderProgram = glCreateProgram();
    glAttachShader(shaderProgram, vertexShader);
    glAttachShader(shaderProgram, fragmentShader);
    glLinkProgram(shaderProgram);
    glUseProgram(shaderProgram);

    float vertices[] = {
        -0.5f, -0.5f, 0.0f,
         0.5f, -0.5f, 0.0f,
         0.0f,  0.5f, 0.0f
    };
    GLuint VBO, VAO;
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &VBO);
    
    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
    
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);

    while (!glfwWindowShouldClose(window)) {
        glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT);

        glUseProgram(shaderProgram);
        glBindVertexArray(VAO);
        glDrawArrays(GL_TRIANGLES, 0, 3);

        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    glDeleteShader(vertexShader);
    glDeleteShader(fragmentShader);
    glfwTerminate();
    return 0;
}

🧬 shader.vert(頂点シェーダー)

#version 330 core
layout(location = 0) in vec3 aPos;
void main() {
    gl_Position = vec4(aPos, 1.0);
}

🎨 shader.frag(フラグメントシェーダー)

#version 330 core
out vec4 FragColor;
void main() {
    FragColor = vec4(1.0, 0.2, 0.2, 1.0); // 赤
}

🛠 CMakeLists.txt(ビルド設定)

cmake_minimum_required(VERSION 3.5)
project(glsl_sample)

set(CMAKE_C_STANDARD 99)

add_executable(glsl_sample main.c)

find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS})

# MSYS2パス用のヒント(MINGW64環境)
include_directories("C:/msys64/mingw64/include")
link_directories("C:/msys64/mingw64/lib")

target_link_libraries(glsl_sample glfw3 glew32 opengl32 gdi32)

🔧 ビルド手順(MSYS2 MINGW64 シェル)

cd /path/to/glsl_sample
mkdir build
cd build
cmake ..
make
./glsl_sample.exe

📌 備考

  • 画面に赤い三角形が表示されれば成功です。
  • GLSLシェーダーは外部ファイルから読み込んで動的にコンパイルしています。
  • shader.vertshader.frag を編集すればリアルタイムに変更反映できます。

-bash: cmake: command not found

ChatGPT said:

それは cmake がインストールされていないエラーです。
MSYS2のMINGW64環境では、以下のコマンドで cmake をインストールできます。


✅ cmake のインストール(MSYS2 MINGW64)

pacman -S mingw-w64-x86_64-cmake

必ず MSYS2の「MINGW64」シェル で実行してください(/mingw64/bin がPATHに入っている状態)

furcr@furcraea_built MINGW64 ~
$ pacman -S mingw-w64-x86_64-cmake
resolving dependencies...
looking for conflicting packages...

Packages (24) mingw-w64-x86_64-brotli-1.1.0-5  mingw-w64-x86_64-c-ares-1.34.5-1
              mingw-w64-x86_64-ca-certificates-20241223-1  mingw-w64-x86_64-cppdap-1.65-1
              mingw-w64-x86_64-curl-8.14.1-1  mingw-w64-x86_64-gnutls-3.8.9-4
              mingw-w64-x86_64-jsoncpp-1.9.6-3  mingw-w64-x86_64-libarchive-3.8.1-2
              mingw-w64-x86_64-libb2-0.98.1-2  mingw-w64-x86_64-libidn2-2.3.8-2
              mingw-w64-x86_64-libpsl-0.21.5-3  mingw-w64-x86_64-libssh2-1.11.1-1
              mingw-w64-x86_64-libtasn1-4.20.0-1  mingw-w64-x86_64-libunistring-1.3-1
              mingw-w64-x86_64-libuv-1.51.0-1  mingw-w64-x86_64-lz4-1.10.0-1
              mingw-w64-x86_64-nettle-3.10.2-1  mingw-w64-x86_64-nghttp2-1.66.0-1
              mingw-w64-x86_64-nghttp3-1.10.1-1  mingw-w64-x86_64-ngtcp2-1.13.0-2
              mingw-w64-x86_64-ninja-1.13.0-1  mingw-w64-x86_64-p11-kit-0.25.5-1
              mingw-w64-x86_64-rhash-1.4.5-1  mingw-w64-x86_64-cmake-4.0.3-1

Total Download Size:    19.46 MiB
Total Installed Size:  106.07 MiB

:: Proceed with installation? [Y/n] Enter

:: Retrieving packages...
 mingw-w64-x86_64-gnutls-3....     2.2 MiB  1013 KiB/s 00:02 [###############################] 100%
 mingw-w64-x86_64-curl-8.14...  1552.7 KiB   666 KiB/s 00:02 [###############################] 100%
 mingw-w64-x86_64-libarchiv...   876.9 KiB   374 KiB/s 00:02 [###############################] 100%
 mingw-w64-x86_64-libunistr...   832.7 KiB   349 KiB/s 00:02 [###############################] 100%
 mingw-w64-x86_64-cmake-4.0...     9.2 MiB  3.44 MiB/s 00:03 [###############################] 100%
 mingw-w64-x86_64-cppdap-1....   491.9 KiB  1152 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-nettle-3....   563.7 KiB  1112 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-brotli-1....   420.5 KiB   947 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-ca-certif...   395.0 KiB   884 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-c-ares-1....   309.2 KiB   671 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libssh2-1...   309.0 KiB   719 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-ngtcp2-1....   269.4 KiB   622 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libuv-1.5...   221.5 KiB   480 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libtasn1-...   196.3 KiB   458 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-nghttp2-1...   194.9 KiB   435 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-p11-kit-0...   422.7 KiB   245 KiB/s 00:02 [###############################] 100%
 mingw-w64-x86_64-rhash-1.4...   219.0 KiB   301 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-ninja-1.1...   186.3 KiB   350 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-jsoncpp-1...   176.1 KiB   387 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libidn2-2...   170.6 KiB   377 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-lz4-1.10....   166.9 KiB   328 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-nghttp3-1...   124.7 KiB   295 KiB/s 00:00 [###############################] 100%
 mingw-w64-x86_64-libpsl-0....    94.4 KiB   181 KiB/s 00:01 [###############################] 100%
 mingw-w64-x86_64-libb2-0.9...    23.7 KiB  53.5 KiB/s 00:00 [###############################] 100%
 Total (24/24)                    19.5 MiB  3.73 MiB/s 00:05 [###############################] 100%
(24/24) checking keys in keyring                             [###############################] 100%
(24/24) checking package integrity                           [###############################] 100%
(24/24) loading package files                                [###############################] 100%
(24/24) checking for file conflicts                          [###############################] 100%
(24/24) checking available disk space                        [###############################] 100%
:: Processing package changes...
( 1/24) installing mingw-w64-x86_64-cppdap                   [###############################] 100%
( 2/24) installing mingw-w64-x86_64-c-ares                   [###############################] 100%
( 3/24) installing mingw-w64-x86_64-brotli                   [###############################] 100%
( 4/24) installing mingw-w64-x86_64-libunistring             [###############################] 100%
( 5/24) installing mingw-w64-x86_64-libidn2                  [###############################] 100%
( 6/24) installing mingw-w64-x86_64-libpsl                   [###############################] 100%
( 7/24) installing mingw-w64-x86_64-libtasn1                 [###############################] 100%
( 8/24) installing mingw-w64-x86_64-p11-kit                  [###############################] 100%
( 9/24) installing mingw-w64-x86_64-ca-certificates          [###############################] 100%
(10/24) installing mingw-w64-x86_64-libssh2                  [###############################] 100%
(11/24) installing mingw-w64-x86_64-nghttp2                  [###############################] 100%
(12/24) installing mingw-w64-x86_64-nettle                   [###############################] 100%
(13/24) installing mingw-w64-x86_64-gnutls                   [###############################] 100%
(14/24) installing mingw-w64-x86_64-ngtcp2                   [###############################] 100%
(15/24) installing mingw-w64-x86_64-nghttp3                  [###############################] 100%
(16/24) installing mingw-w64-x86_64-curl                     [###############################] 100%
(17/24) installing mingw-w64-x86_64-jsoncpp                  [###############################] 100%
(18/24) installing mingw-w64-x86_64-libb2                    [###############################] 100%
(19/24) installing mingw-w64-x86_64-lz4                      [###############################] 100%
(20/24) installing mingw-w64-x86_64-libarchive               [###############################] 100%
(21/24) installing mingw-w64-x86_64-libuv                    [###############################] 100%
(22/24) installing mingw-w64-x86_64-ninja                    [###############################] 100%
(23/24) installing mingw-w64-x86_64-rhash                    [###############################] 100%
(24/24) installing mingw-w64-x86_64-cmake                    [###############################] 100%
Optional dependencies for mingw-w64-x86_64-cmake
    mingw-w64-x86_64-emacs: for cmake emacs mode

furcr@furcraea_built MINGW64 ~
$

✅ インストール確認

which cmake

$ which cmake
/mingw64/bin/cmake

これで /mingw64/bin/cmake と表示されれば OK。あとは前の手順どおり cmake .. && make でビルドできます。


furcr@furcraea_built MINGW64 ~
$ cd C:\glsl_sample

furcr@furcraea_built MINGW64 /c/glsl_sample
$ cd build

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$ cmake ..
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.


-- Configuring incomplete, errors occurred!

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$

完璧です、CMakeはちゃんと動いています
出ているエラーは単に CMakeLists.txt のバージョン指定が古いというだけなので、すぐに修正できます。


✅ 修正方法:CMakeLists.txt の1行目を更新

🔧 変更前:

cmake_minimum_required(VERSION 3.0)

✅ 変更後

cmake_minimum_required(VERSION 3.5)

または、より安全にするならこうしてもOKです:

cmake_minimum_required(VERSION 3.5...3.27)

これは「3.5以上〜3.27以下で対応」と明記する形です(今のMSYS2ではだいたい3.27〜3.29あたりが入ります)。

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$ make
-bash: make: command not found

なので

🧩 補足:make がないとき

pacman -S make
furcr@furcraea_built MINGW64 ~
$ pacman -S make
resolving dependencies...
looking for conflicting packages...

Packages (1) make-4.4.1-2

Total Download Size:   0.50 MiB
Total Installed Size:  1.61 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages...
 make-4.4.1-2-x86_64             507.6 KiB   320 KiB/s 00:02 [###############################] 100%
(1/1) checking keys in keyring                               [###############################] 100%
(1/1) checking package integrity                             [###############################] 100%
(1/1) loading package files                                  [###############################] 100%
(1/1) checking for file conflicts                            [###############################] 100%
(1/1) checking available disk space                          [###############################] 100%
:: Processing package changes...
(1/1) installing make                                        [###############################] 100%
:: Running post-transaction hooks...
(1/1) Updating the info directory file...

furcr@furcraea_built MINGW64 ~
$

または MINGW版を使うなら:

pacman -S mingw-w64-x86_64-make

furcr@furcraea_built MINGW64 ~
$ pacman -S mingw-w64-x86_64-make
warning: mingw-w64-x86_64-make-4.4.1-3 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) mingw-w64-x86_64-make-4.4.1-3

Total Installed Size:  0.29 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring                               [###############################] 100%
(1/1) checking package integrity                             [###############################] 100%
(1/1) loading package files                                  [###############################] 100%
(1/1) checking for file conflicts                            [###############################] 100%
(1/1) checking available disk space                          [###############################] 100%
:: Processing package changes...
(1/1) reinstalling mingw-w64-x86_64-make                     [###############################] 100%

furcr@furcraea_built MINGW64 ~
$

その場合、呼び出しは mingw32-make になるかもしれません。

対処法:明示的に Makefile を出させる

🔁 ビルドフォルダをクリア

まず、前回のビルドキャッシュを消します:

cd ..
rm -rf build
mkdir build
cd build

✅ CMakeを正しく実行(MSYS Makefiles 指定)

cmake -G "MSYS Makefiles" ..
furcr@furcraea_built MINGW64 /c/glsl_sample/build
$ cmake -G "MSYS Makefiles" ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- The C compiler identification is GNU 15.1.0
-- The CXX compiler identification is GNU 15.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: opengl32
-- Configuring done (1.2s)
-- Generating done (0.0s)
-- Build files have been written to: C:/glsl_sample/build

これで Makefile がちゃんと生成されるはずです。

📌 補足:-G オプションとは?

CMakeはデフォルトで “NMake” や “Visual Studio” 用のプロジェクトファイルを生成することがあります。
MSYS2で make を使いたい場合は、必ず -G "MSYS Makefiles" を指定しないと Makefile が生成されません。

🔨 再度ビルド

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$ make
[ 50%] Building C object CMakeFiles/glsl_sample.dir/main.c.obj
[100%] Linking C executable glsl_sample.exe
[100%] Built target glsl_sample

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$

🧪 もしそれでもだめなら

最終手段として、以下で手動ビルドできます:

gcc ../main.c -o glsl_sample.exe -lglfw3 -lglew32 -lopengl32 -lgdi32

✅ 次にやること:実行!

cd ..
./glsl_sample.exe

✅ やり直し

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$ cd ..

furcr@furcraea_built MINGW64 /c/glsl_sample
$ rm -rf build

furcr@furcraea_built MINGW64 /c/glsl_sample
$ mkdir build

furcr@furcraea_built MINGW64 /c/glsl_sample
$ cd build

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$ cmake -G "MSYS Makefiles" ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- The C compiler identification is GNU 15.1.0
-- The CXX compiler identification is GNU 15.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: opengl32
-- Configuring done (1.2s)
-- Generating done (0.0s)
-- Build files have been written to: C:/glsl_sample/build

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$ make
[ 50%] Building C object CMakeFiles/glsl_sample.dir/main.c.obj
[100%] Linking C executable glsl_sample.exe
[100%] Built target glsl_sample

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$ ./glsl_sample.exe
Failed to open shader.vert

furcr@furcraea_built MINGW64 /c/glsl_sample/build
$

できたああああああ

[VSM] Non-Nanite Marking Job Queue overflow. Performance may be affected. This occurs when many non-nanite meshes cover a large area of the shadow map. (1 seconds ago)

[VSM] Non-Nanite Marking Job Queue overflow. Performance may be affected. This occurs when many non-nanite meshes cover a large area of the shadow map. (1 seconds ago)

解決策は簡単でした。すべてのボックス/プレーン/スタティックメッシュをダブルクリックして、Naniteサポートを有効にするだけです。お役に立てれば幸いです。

URL

https://forums.unrealengine.com/t/non-nanite-marking-job-queue-overflow-warning/2172645/2

ゲームプログラミングC++の14章に出てくる動かないサンプルソースを動かすためのメモ

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter10\AudioSystem.cpp(11,10): error C1083: Cannot open include file: ‘fmod_studio.hpp’: No such file or directory

なので3つの設定をやってしまった。

ーーーーーーーーーーーーーーーーーーーーーー

Visual Studioの場合:
Gameプロジェクトを右クリックし、[プロパティ]を選択。
[C/C++] → [追加のインクルードディレクトリ] を選び、FMODのインクルードフォルダのパス
(例:
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc
)を追加。
変更後、プロジェクトを再ビルドしてみてください。

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

1>LINK : fatal error LNK1104: cannot open file ‘fmodL_vc.lib’
1>LINK : fatal error LNK1104: cannot open file ‘fmodstudioL_vc.lib’
[リンカー] → [追加の依存ファイル]にFMODのライブラリを追加します。
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

Build EventのPostを

xcopy "$(ProjectDir)\..\external\SDL\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "$(ProjectDir)\..\external\GLEW\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86\*.dll" "$(OutDir)" /i /s /y



AudioSystem.cpp(59,11)をコメントして
//mSystem->getLowLevelSystem(&mLowLevelSystem);

SoundEvent.cpp(83,10)をコメントして
//event->setParameterValue(name.c_str(), value);

SoundEvent.cpp(126,10)をコメントして
//event->getParameterValue(name.c_str(), &retVal);

できたー

ゲームプログラミングC++の13章に出てくる動かないサンプルソースを動かすためのメモ

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter10\AudioSystem.cpp(11,10): error C1083: Cannot open include file: ‘fmod_studio.hpp’: No such file or directory

なので3つの設定をやってしまった。

ーーーーーーーーーーーーーーーーーーーーーー

Visual Studioの場合:
Gameプロジェクトを右クリックし、[プロパティ]を選択。
[C/C++] → [追加のインクルードディレクトリ] を選び、FMODのインクルードフォルダのパス
(例:
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc
)を追加。
変更後、プロジェクトを再ビルドしてみてください。

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

1>LINK : fatal error LNK1104: cannot open file ‘fmodL_vc.lib’
1>LINK : fatal error LNK1104: cannot open file ‘fmodstudioL_vc.lib’
[リンカー] → [追加の依存ファイル]にFMODのライブラリを追加します。
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

Build EventのPostを

xcopy "$(ProjectDir)\..\external\SDL\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "$(ProjectDir)\..\external\GLEW\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86\*.dll" "$(OutDir)" /i /s /y



AudioSystem.cpp(59,11)をコメントして
//mSystem->getLowLevelSystem(&mLowLevelSystem);

SoundEvent.cpp(83,10)をコメントして
//event->setParameterValue(name.c_str(), value);

SoundEvent.cpp(126,10)をコメントして
//event->getParameterValue(name.c_str(), &retVal);

できたー

ゲームプログラミングC++の12章に出てくる動かないサンプルソースを動かすためのメモ

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter10\AudioSystem.cpp(11,10): error C1083: Cannot open include file: ‘fmod_studio.hpp’: No such file or directory

なので3つの設定をやってしまった。

ーーーーーーーーーーーーーーーーーーーーーー

Visual Studioの場合:
Gameプロジェクトを右クリックし、[プロパティ]を選択。
[C/C++] → [追加のインクルードディレクトリ] を選び、FMODのインクルードフォルダのパス
(例:
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc
)を追加。
変更後、プロジェクトを再ビルドしてみてください。

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

1>LINK : fatal error LNK1104: cannot open file ‘fmodL_vc.lib’
1>LINK : fatal error LNK1104: cannot open file ‘fmodstudioL_vc.lib’
[リンカー] → [追加の依存ファイル]にFMODのライブラリを追加します。
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

Build EventのPostを

xcopy "$(ProjectDir)\..\external\SDL\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "$(ProjectDir)\..\external\GLEW\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86\*.dll" "$(OutDir)" /i /s /y

にした。

AudioSystem.cpp(59,11)をコメントして
//mSystem->getLowLevelSystem(&mLowLevelSystem);

SoundEvent.cpp(83,10)をコメントして
//event->setParameterValue(name.c_str(), value);

SoundEvent.cpp(126,10)をコメントして
//event->getParameterValue(name.c_str(), &retVal);

できたー

ゲームプログラミングC++の11章に出てくる動かないサンプルソースを動かすためのメモ

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter10\AudioSystem.cpp(11,10): error C1083: Cannot open include file: ‘fmod_studio.hpp’: No such file or directory

なので3つの設定をやってしまった。

ーーーーーーーーーーーーーーーーーーーーーー

Visual Studioの場合:
Gameプロジェクトを右クリックし、[プロパティ]を選択。
[C/C++] → [追加のインクルードディレクトリ] を選び、FMODのインクルードフォルダのパス
(例:
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc
)を追加。
変更後、プロジェクトを再ビルドしてみてください。

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

1>LINK : fatal error LNK1104: cannot open file ‘fmodL_vc.lib’
1>LINK : fatal error LNK1104: cannot open file ‘fmodstudioL_vc.lib’
[リンカー] → [追加の依存ファイル]にFMODのライブラリを追加します。
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

Build EventのPostを

xcopy "$(ProjectDir)\..\external\SDL\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "$(ProjectDir)\..\external\GLEW\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86\*.dll" "$(OutDir)" /i /s /y

にした。

AudioSystem.cpp(59,11)をコメントして
//mSystem->getLowLevelSystem(&mLowLevelSystem);

SoundEvent.cpp(83,10)をコメントして
//event->setParameterValue(name.c_str(), value);

SoundEvent.cpp(126,10)をコメントして
//event->getParameterValue(name.c_str(), &retVal);

できたー

ゲームプログラミングC++の10章に出てくる動かないサンプルソースを動かすためのメモ

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter10\AudioSystem.cpp(11,10): error C1083: Cannot open include file: ‘fmod_studio.hpp’: No such file or directory

なので3つの設定をやってしまった。

ーーーーーーーーーーーーーーーーーーーーーー

Visual Studioの場合:
Gameプロジェクトを右クリックし、[プロパティ]を選択。
[C/C++] → [追加のインクルードディレクトリ] を選び、FMODのインクルードフォルダのパス
(例:
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc
)を追加。
変更後、プロジェクトを再ビルドしてみてください。

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

1>LINK : fatal error LNK1104: cannot open file ‘fmodL_vc.lib’
1>LINK : fatal error LNK1104: cannot open file ‘fmodstudioL_vc.lib’
[リンカー] → [追加の依存ファイル]にFMODのライブラリを追加します。
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86

ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

Build EventのPreを

xcopy "$(ProjectDir)\..\external\SDL\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "$(ProjectDir)\..\external\GLEW\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86\*.dll" "$(OutDir)" /i /s /y

あとはコメント化して無効化の修正

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter10\AudioSystem.cpp(59,11): error C2039: ‘getLowLevelSystem’: is not a member of ‘FMOD::Studio::System’
//mSystem->getLowLevelSystem(&mLowLevelSystem);にコメントして無効化

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter10\SoundEvent.cpp(83,10): error C2039: ‘setParameterValue’: is not a member of ‘FMOD::Studio::EventInstance’
//event->setParameterValue(name.c_str(), value);にコメントして無効化


1>D:\Sandbox\gameprogcpp_code\code-master\Chapter10\SoundEvent.cpp(126,10): error C2039: ‘getParameterValue’: is not a member of ‘FMOD::Studio::EventInstance’
//event->getParameterValue(name.c_str(), &retVal);にコメントして無効化

できたー

ゲームプログラミングC++の9章に出てくる動かないサンプルソースを動かすためのメモ

基本7章と同じ

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter09\SoundEvent.cpp(11,10): error C1083: Cannot open include file: ‘fmod_studio.hpp’: No such file or directory

Visual Studioの場合:
Gameプロジェクトを右クリックし、[プロパティ]を選択。
[C/C++] → [追加のインクルードディレクトリ] を選び、FMODのインクルードフォルダのパス
(例:
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc
)を追加。
変更後、プロジェクトを再ビルドしてみてください。

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter09\AudioSystem.cpp(59,11): error C2039: ‘getLowLevelSystem’: is not a member of ‘FMOD::Studio::System’
1> D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc\fmod_studio.hpp(36,11):
//mSystem->getLowLevelSystem(&mLowLevelSystem);//コメントアウト

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter09\SoundEvent.cpp(83,10): error C2039: ‘setParameterValue’: is not a member of ‘FMOD::Studio::EventInstance’
1> D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc\fmod_studio.hpp(184,11):
1> see declaration of ‘FMOD::Studio::EventInstance’
//event->setParameterValue(name.c_str(), value);//コメントアウト

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter09\SoundEvent.cpp(126,10): error C2039: ‘getParameterValue’: is not a member of ‘FMOD::Studio::EventInstance’
1> D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc\fmod_studio.hpp(184,11):
1> see declaration of ‘FMOD::Studio::EventInstance’
//event->getParameterValue(name.c_str(), &retVal);//コメントアウト

で解決して次のエラー

1>LINK : fatal error LNK1104: cannot open file ‘fmodL_vc.lib’
1>LINK : fatal error LNK1104: cannot open file ‘fmodstudioL_vc.lib’
[リンカー] → [追加の依存ファイル]にFMODのライブラリを追加します。
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86

1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: The command “xcopy “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\..\external\SDL\lib\win\x86*.dll” “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\Debug\” /i /s /y
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: xcopy “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\..\external\GLEW\lib\win\x86*.dll” “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\Debug\” /i /s /y
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: xcopy “C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\lowlevel\lib*.dll” “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\Debug\” /i /s /y
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: xcopy “C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib*.dll” “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\Debug\” /i /s /y
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073:
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd” exited with code 4.

対処手順:
1,Visual Studioを管理者として実行します。
2,プロジェクトのプロパティを開き、ビルド設定でDLLファイルのコピーが正しく行われているか確認します。
3、ターゲットディレクトリのアクセス許可を確認し、必要に応じて変更します。
4,DLLファイルのパスが正しいか確認します。
5,FMOD Studio APIが正しくインストールされているか確認します。
上記を確認後、再度ビルドを実行します。

fmodL.dll が見つからないため、コードの実行を続行できません。プログラムを
再インストールすると、この問題が解決する可能性があります。

元はこうだった

xcopy "$(ProjectDir)\..\external\SDL\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "$(ProjectDir)\..\external\GLEW\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\lowlevel\lib\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\*.dll" "$(OutDir)" /i /s /y

直して

xcopy "$(ProjectDir)\..\external\SDL\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "$(ProjectDir)\..\external\GLEW\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86\*.dll" "$(OutDir)" /i /s /y

こうした

できたー

ゲームプログラミングC++の7章に出てくる動かないサンプルソースを動かすためのメモ

7章のslnは

こうゆうエラーを吐く

1>D:\Sandbox\gameprogcpp_code\code-master\Chapter07\AudioSystem.cpp(11,10): error C1083: Cannot open include file: ‘fmod_studio.hpp‘: No such file or directory

1>D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc\fmod_studio_common.h(14,10): error C1083: Cannot open include file: ‘fmod.h‘: No such file or directory
1>(compiling source file ‘AudioSystem.cpp’)

fmodを使うので

ユーザー登録をしてダウンロードしてくる 今回はDドライブにインストールした。
https://www.fmod.com/download

Visual Studioの場合:
Gameプロジェクトを右クリックし、[プロパティ]を選択。
[C/C++] → [追加のインクルードディレクトリ] を選び、FMODのインクルードフォルダのパス
(例:
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc
)を追加。
変更後、プロジェクトを再ビルドしてみてください。


英語
1>D:\Sandbox\gameprogcpp_code\code-master\Chapter07\SoundEvent.cpp(83,10): error C2039: ‘setParameterValue’: is not a member of ‘FMOD::Studio::EventInstance’
1> D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc\fmod_studio.hpp(184,11):
1> see declaration of ‘FMOD::Studio::EventInstance’
1>D:\Sandbox\gameprogcpp_code\code-master\Chapter07\SoundEvent.cpp(126,10): error C2039: ‘getParameterValue’: is not a member of ‘FMOD::Studio::EventInstance’
1> D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc\fmod_studio.hpp(184,11):
1> see declaration of ‘FMOD::Studio::EventInstance’


日本語
1>D:\Sandbox\gameprogcpp_code\code-master\Chapter07\SoundEvent.cpp(83,10): エラー C2039: ‘setParameterValue’: は ‘FMOD::Studio::EventInstance’ のメンバーではありません
83行をコメントアウト
//event->setParameterValue(name.c_str(), value);

1>D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc\fmod_studio.hpp(184,11):
1> ‘FMOD::Studio::EventInstance’ の宣言を参照してください
1>D:\Sandbox\gameprogcpp_code\code-master\Chapter07\SoundEvent.cpp(126,10): エラー C2039: ‘getParameterValue‘: は ‘FMOD::Studio::EventInstance’ のメンバーではありません
127行をコメントアウト
//event->getParameterValue(name.c_str(), &retVal);

1>D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc\fmod_studio.hpp(184,11):
1> ‘FMOD::Studio::EventInstance’ の宣言を参照してください


1>D:\Sandbox\gameprogcpp_code\code-master\Chapter07\AudioSystem.cpp(59,11): error C2039: ‘getLowLevelSystem‘: is not a member of ‘FMOD::Studio::System’
1> D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\inc\fmod_studio.hpp(36,11):
1> see declaration of ‘FMOD::Studio::System’
AudioSystem.cpp(59,11)をコメントアウト
//mSystem->getLowLevelSystem(&mLowLevelSystem);

1>LINK : fatal error LNK1104: cannot open file ‘fmodL_vc.lib’
1>LINK : fatal error LNK1104: cannot open file ‘fmodstudioL_vc.lib’
[リンカー] → [追加の依存ファイル]にFMODのライブラリを追加します。
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86
D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86

1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: The command “xcopy “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\..\external\SDL\lib\win\x86*.dll” “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\Debug\” /i /s /y
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: xcopy “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\..\external\GLEW\lib\win\x86*.dll” “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\Debug\” /i /s /y
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: xcopy “C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\lowlevel\lib*.dll” “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\Debug\” /i /s /y
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: xcopy “C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib*.dll” “D:\Sandbox\gameprogcpp_code\code-master\Chapter07\Debug\” /i /s /y
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073:
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd” exited with code 4.

対処手順:
1,Visual Studioを管理者として実行します。
2,プロジェクトのプロパティを開き、ビルド設定でDLLファイルのコピーが正しく行われているか確認します。
3、ターゲットディレクトリのアクセス許可を確認し、必要に応じて変更します。
4,DLLファイルのパスが正しいか確認します。
5,FMOD Studio APIが正しくインストールされているか確認します。
上記を確認後、再度ビルドを実行します。

fmodL.dll が見つからないため、コードの実行を続行できません。プログラムを
再インストールすると、この問題が解決する可能性があります。

元はこうだったが

xcopy "$(ProjectDir)\..\external\SDL\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "$(ProjectDir)\..\external\GLEW\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\lowlevel\lib\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\*.dll" "$(OutDir)" /i /s /y

を直して

xcopy "$(ProjectDir)\..\external\SDL\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "$(ProjectDir)\..\external\GLEW\lib\win\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x86\*.dll" "$(OutDir)" /i /s /y
xcopy "D:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\lib\x86\*.dll" "$(OutDir)" /i /s /y

にした

起動した!!

[UE554][VSM] One Pass Projection max lights overflow. If you see shadow artifacts, decrease the amount of local lights per pixel, or increase r.Shadow.Virtual.OnePassProjection MaxLightsPerPixel. (0 seconds ago) (;f

エラー内容

[VSM] One Pass Projection max lights overflow. If you see shadow artifacts, decrease the amount of local lights per pixel, or increase r.Shadow.Virtual.OnePassProjection MaxLightsPerPixel. (0 seconds ago) (;f

[VSM] ワンパスプロジェクションの最大ライト数がオーバーフローしました。影のアーティファクトが見られる場合は、ピクセルあたりのローカルライトの量を減らすか、r.Shadow.Virtual.OnePassProjection MaxLightsPerPixel の値を増やしてください。(0秒前) (;f

コンソールコマンドで解決するらしい。

https://forums.unrealengine.com/t/lumen-artifacts-in-shadows-with-many-movable-lights/1747817/2

r.Shadow.Virtual.OnePassProjection MaxLightsPerPixel =16

r.Shadow.Virtual.OnePassProjection MaxLightsPerPixel = 128

黄色い文字は消えた。

参考

https://dev.epicgames.com/documentation/ja-jp/unreal-engine/virtual-shadow-maps-in-unreal-engine