QScintilla 2 のインストール(Windows 上)

QScintilla 2は,Qtフレームワークのエディタコンポーネントである.Windows上でのインストール手順は以下の通り:まずQtをインストールし,その後QScintillaのソースコードをダウンロードして解凍する.Visual StudioのNative Toolsコマンドプロンプトを使用し,qmakeでプロジェクトファイルを生成,nmakeでデバッグ版とリリース版をビルドする.エラーが発生した場合は,必要に応じてヘッダーファイルを修正する.

前準備

Build Tools for Visual Studio 2026(ビルドツール)のインストール

Build Tools for Visual Studio 2026(ビルドツール)のインストールを行い、C/C++ コードのビルド環境を整える。

[Build Tools for Visual Studio 2026(ビルドツール)のインストール手順を見るには、ここをクリック]

Windows での Build Tools for Visual Studio 2026 のインストール

Build Tools for Visual Studio は,Visual Studio の IDE を含まない C/C++ コンパイラ,ライブラリ,ビルドツール等のコマンドライン向け開発ツールセットである。インストール済みの場合,この手順は不要である。

以下のコマンドは、Build Tools が未インストールの場合は winget で新規インストールし、インストール済みの場合は setup.exe modify でコンポーネントを追加する(バージョンは変更しない)。

インストールコマンドの実行方法

管理者権限コマンドプロンプトを起動する(手順:Windows キーまたはスタートメニュー → cmd と入力 → 右クリック → 「管理者として実行」)。そして、コマンド全体をコマンドプロンプトにコピー&ペーストする。

REM VC++ ランタイム
winget install --scope machine --id Microsoft.VCRedist.2015+.x64 -e --silent --disable-interactivity --force --accept-source-agreements --accept-package-agreements --override "/quiet /norestart"

REM ============================================================
REM Visual Studio Build Tools + Desktop development with C++
REM (VCTools、MSBuildTools、CMake連携、Clang、Windows 11 SDK)
REM ============================================================
REM 進行中のインストーラーを停止(ロック競合回避)
taskkill /F /IM vs_setup.exe /T >nul 2>&1
taskkill /F /IM vs_installer.exe /T >nul 2>&1
taskkill /F /IM vs_installerservice.exe /T >nul 2>&1

REM 未インストール時: winget で新規インストール
REM インストール済み時: setup.exe modify でコンポーネント追加(バージョンは変更しない)
winget list --id Microsoft.VisualStudio.BuildTools 2>nul | findstr /i "BuildTools" >nul 2>&1
if %ERRORLEVEL% EQU 0 (
    for /f "usebackq delims=" %P in (`"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -property installationPath`) do start /wait "" "C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" modify --installPath "%P" --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Component.VC.CMake.Project --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --add Microsoft.VisualStudio.Component.Windows11SDK.26100 --includeRecommended --quiet --norestart --nocache
) else (
    winget install --scope machine --id Microsoft.VisualStudio.BuildTools -e --silent --disable-interactivity --force --accept-source-agreements --accept-package-agreements --override "--quiet --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Component.VC.CMake.Project --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --add Microsoft.VisualStudio.Component.Windows11SDK.26100"
)

REM 破損時の修復(任意、動作がおかしくなった場合)
REM "C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" repair --installPath "C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools" --quiet --norestart

REM 導入確認(インストールパスが表示されれば正常)
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -products * -requires Microsoft.VisualStudio.Workload.VCTools -property installationPath

上記のコマンドでは、Build Tools 本体と Visual C++ 再頒布可能パッケージをインストールし、続いて以下のコンポーネントを追加している。

上記以外の追加のコンポーネントが必要になった場合は Visual Studio Installer で個別にインストールできる。

インストール完了の確認

winget list Microsoft.VisualStudio.BuildTools

Visual Studio を必要とするとき

Visual Studio の機能を必要とする場合は,追加インストールできる。

QScintilla 2 のインストール(Windows 上)

Qt のインストール

QScintilla 2 のインストール(Windows 上)

  1. Riverbank の QScintilla 2 の Web ページを開く

    利用条件などを確認.

    https://riverbankcomputing.com/software/qscintilla

  2. QScintilla 2 のダウンロードのページを開く

    https://riverbankcomputing.com/software/qscintilla/download

  3. バージョン 2.10.8 をダウンロードする

    新しいバージョンは,うまくインストールできない可能性がある.

  4. ダウンロードした .zip ファイルを展開(解凍)する.
    Windows での展開(解凍)に便利な 7-Zip: 別ページ »で説明
  5. 展開(解凍)して出来たファイルは,分かりやすいディレクトリ(例えば,C:\QScintilla_gpl-2.10.8)に移す.
  6. 以下の操作をx64 Native Tools コマンドプロンプト (x64 Native Tools Command Prompt)で実行する   (手順:スタートメニュー →「Visual Studio 2026」の下の「x64 Native Tools コマンドプロンプト (x64 Native Tools Command Prompt)」を選ぶ)。
    「x64 Native Tools コマンドプロンプト」がないときは,ビルドツール (Build Tools) をインストールすると,x64 Native Tools コマンドプロンプトもインストールされる.その手順は,別ページ »で説明している.
  7. 次のように操作する.
    cd Qt4Qt5
    qmake qscintilla.pro
    
  8. 引き続き,次のように操作する.
    nmake -f Makefile.Debug
    nmake -f Makefile.Release
    

    QURL に関するエラーが出たときは, C:\Qt\4.7.4\src\corelib\kernel\qmimedata.h の 47 行目に,次の行を追加すると解決する可能性がある.

    #include<QtCore/qurl.h>
    

【まとめ】 Qtをインストール後,QScintillaをダウンロード,qmakeとnmakeでビルド.