You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编译pgAgent遇wx/setup.h缺失错误,寻求解决方法

Fixing the wx/setup.h Missing Error When Compiling pgAgent 3.4.0

Hey, let's tackle that wx/setup.h missing error you're hitting while compiling pgAgent 3.4.0. This is a common compatibility hiccup between the older wxWidgets 2.8 and Visual Studio 2017 (VC15), but we can work through it step by step:

1. Adapt wxWidgets 2.8 for VC15 Compatibility

wxWidgets 2.8 doesn't natively support VS2017, so we need to manually set up the critical setup.h file:

  • Head to F:\pgbuild\wxWidgets\include\wx\msw, copy setup0.h, and rename the copy to setup.h.
  • Open this new setup.h and add VC15 (VS2017) support by inserting these lines:
    // Add VC15 (VS2017) compiler detection
    #if defined(_MSC_VER) && (_MSC_VER >= 1910)
        #define __VISUALC15__
        #define wxUSE_COMPILER_TLS 1
    #endif
    
  • Double-check that wxUSE_DYNAMIC_LINKING matches your wxWidgets build mode: set it to 0 for static builds, 1 for dynamic builds.

2. Recompile wxWidgets and Verify File Paths

Your earlier compile of wx_vc15.sln might not have generated the correct directory structure. Let's fix that:

  • Open F:\pgbuild\wxWidgets\build\msw\wx_vc15.sln. Right-click the solution, go to Properties, and confirm all projects are set to Debug configuration and the correct platform (x86 if your PostgreSQL 9.6 is 32-bit, x64 if it's 64-bit).
  • Rebuild the entire solution. After it finishes, check that F:\pgbuild\wxWidgets\lib\vc_lib\mswd\wx\ exists and contains your modified setup.h. If it's missing, manually copy the setup.h you edited into that folder.

3. Correct pgAgent's CMake Configuration

The pgAgent CMake script might not be picking up the wxWidgets path correctly for VC15. Let's manually set those values:

  • Open CMake GUI, set the source directory to F:\pgbuild\pgAgent-3.4.0 and the build directory to something like F:\pgbuild\pgAgent-build.
  • Click Configure, select Visual Studio 15 2017 as your generator. Once that finishes, find these settings in the configuration list and update them:
    • wxWidgets_ROOT_DIR: Set to F:\pgbuild\wxWidgets
    • wxWidgets_LIB_DIR: Manually point to F:\pgbuild\wxWidgets\lib\vc_lib
    • wxWidgets_CONFIGURATION: Set to mswd (matches the Debug static library we built)
  • Click Configure again to make sure there are no red errors, then click Generate to create the updated solution file.

4. Double-Check Environment Variables and Build Order

  • Make sure your WXWIN and wxMSW environment variables are both set to F:\pgbuild\wxWidgets, then restart Visual Studio—it won't pick up new environment variables until you do.
  • Open the generated pgAgent solution. If there are any wxWidgets-related dependency projects, build those first before compiling the main pgAgent project.

Bonus Tip

pgAgent 3.4.0 is pretty old, and it was designed for older toolchains. If you're still hitting snags after all this, consider downgrading to Visual Studio 2015 (VC14)—it's the latest VS version that wxWidgets 2.8 officially supports, and it'll save you a lot of compatibility hoops.

内容的提问来源于stack exchange,提问作者arthur

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:29:38