无法使用 Scons 创建 C++ dll
Unable to create c++ dll using Scons
我正在尝试在 Scons 中编译一个 C++ 程序。对于 C++,它给出以下错误:
o Untitled_game_godot\bin\win64\libgd.dll -shared -Lgodot-cpp\bin -llibgodot-cpp.windows.debug.64
o not recognized as an internal command
我试过改变
env.Replace(CXX = "C:/cygwin/bin/")
要么
env.Replace(CXX = "C:/cygwin/bin/g++.exe")
但它没有帮助。
谁知道这件事,谁能帮我解决这个问题?
我在下面附上了我的 Scons 文件、工作目录和环境变量
构建
#!python
import os, subprocess
opts = Variables([], ARGUMENTS)
# Gets the standard flags CC, CCX, etc.
env = DefaultEnvironment(tools = ['g++', 'link'])
#env.Replace(CXX = "compiler/g++.exe")
# Define our options
opts.Add(EnumVariable('target', "Compilation target", 'debug', ['d', 'debug', 'r', 'release']))
opts.Add(EnumVariable('platform', "Compilation platform", '', ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no'))
opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'Untitled_game_godot/bin/'))
opts.Add(PathVariable('target_name', 'The library name.', 'libgd', PathVariable.PathAccept))
# Local dependency paths, adapt them to your setup
godot_headers_path = "godot-cpp/godot-headers/"
cpp_bindings_path = "godot-cpp/"
cpp_library = "libgodot-cpp"
# only support 64 at this time..
bits = 64
# Updates the environment with the option variables.
opts.Update(env)
# Process some arguments
if env['use_llvm']:
env['CC'] = 'clang'
env['CXX'] = 'clang++'
if env['p'] != '':
env['platform'] = env['p']
if env['platform'] == '':
print("No valid target platform selected.")
quit();
# Check our platform specifics
if env['platform'] == "osx":
env['target_path'] += 'osx/'
cpp_library += '.osx'
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS = ['-g','-O2', '-arch', 'x86_64', '-std=c++17'])
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
else:
env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64', '-std=c++17'])
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
elif env['platform'] in ('x11', 'linux'):
env['target_path'] += 'x11/'
cpp_library += '.linux'
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS = ['-fPIC', '-g3','-Og', '-std=c++17'])
else:
env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++17'])
elif env['platform'] == "windows":
env['target_path'] += 'win64/'
cpp_library += '.windows'
# This makes sure to keep the session environment variables on windows,
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
env.Append(ENV = os.environ)
env.Append(CCFLAGS = ['-DWIN32', '-D_WIN32', '-D_WINDOWS', '-W3', '-GR', '-D_CRT_SECURE_NO_WARNINGS'])
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '-MDd'])
else:
env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '-MD'])
if env['target'] in ('debug', 'd'):
cpp_library += '.debug'
else:
cpp_library += '.release'
cpp_library += '.' + str(bits)
# make sure our binding library is properly includes
env.Append(CPPPATH=['.', godot_headers_path, cpp_bindings_path + 'include/', cpp_bindings_path + 'include/core/', cpp_bindings_path + 'include/gen/'])
env.Append(LIBPATH=[cpp_bindings_path + 'bin/'])
env.Append(LIBS=[cpp_library])
# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=['src/'])
sources = Glob('src/*.cpp')
library = env.SharedLibrary(target=env['target_path'] + env['target_name'] , source=sources)
Default(library)
# Generates help for the -h scons option.
Help(opts.GenerateHelpText(env))
工作树
.
├── Untitled_game_godot
│ ├── UI
│ │ └── main_menu
│ └── bin
│ └── win64
└── godot-cpp
├── __pycache__
├── bin
├── godot-headers
│ ├── android
│ ├── arvr
│ ├── gdnative
│ ├── images
│ │ └── faq
│ ├── nativescript
│ ├── net
│ ├── pluginscript
│ └── videodecoder
├── include
│ ├── core
│ └── gen
├── misc
│ ├── ci
│ ├── hooks
│ └── scripts
├── src
│ ├── core
│ └── gen
└── test
└── src
所有环境变量:
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\mihac\AppData\Roaming
CL=C:\cygwin64\bin\cl.exe
CommandPromptType=Native
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=DESKTOP-257N8M8
ComSpec=C:\Windows\system32\cmd.exe
DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\
DriverData=C:\Windows\System32\Drivers\DriverData
ExtensionSdkDir=C:\Program Files (x86)\Microsoft SDKs\Windows Kits\ExtensionSDKs
Framework40Version=v4.0
FrameworkDir=C:\Windows\Microsoft.NET\Framework64\
FrameworkDir64=C:\Windows\Microsoft.NET\Framework64\
FrameworkVersion=v4.0.30319
FrameworkVersion64=v4.0.30319
HOMEDRIVE=C:
HOMEPATH=\Users\mihac
HTMLHelpDir=C:\Program Files (x86)\HTML Help Workshop
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\include;C:\Program Files (x86)\Windows Kits\NETFXSDK.8\include\um;C:\Program Files (x86)\Windows Kits\include.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\include.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\include.0.18362.0\um;C:\Program Files (x86)\Windows Kits\include.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\include.0.18362.0\cppwinrt
LIB=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\lib.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\lib.0.18362.0\um\x64
LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\UnionMetadata.0.18362.0;C:\Program Files (x86)\Windows Kits\References.0.18362.0;C:\Windows\Microsoft.NET\Framework64\v4.0.30319
LOCALAPPDATA=C:\Users\mihac\AppData\Local
LOGONSERVER=\DESKTOP-257N8M8
NETFXSDKDir=C:\Program Files (x86)\Windows Kits\NETFXSDK.8\
NUMBER_OF_PROCESSORS=12
OneDrive=C:\Users\mihac\OneDrive
OneDriveConsumer=C:\Users\mihac\OneDrive
OS=Windows_NT
Path=C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\Extensions\Microsoft\IntelliCode\CLI;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio19\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Windows Kits\bin.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\Tools\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;D:\Apps\bin;C:\Program Files (x86)\dotnet\;C:\Users\mihac\AppData\Local\Programs\Python\Python310;C:\Users\mihac\AppData\Local\Programs\Python\Python310\Scripts;C:\Users\mihac\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\mihac\AppData\Local\Programs\Python\Python310\;C:\Users\mihac\AppData\Local\Microsoft\WindowsApps;C:\Users\mihac\AppData\Local\Programs\Microsoft VS Code\bin;D:\Apps\php5;D:\Apps\php5\ext;C:\cygwin64\bin;;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Platform=x64
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=9e0a
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
PYTHONPATH=C:\Users\mihac\AppData\Local\Programs\Python\Python310
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\mihac\AppData\Local\Temp
TMP=C:\Users\mihac\AppData\Local\Temp
UCRTVersion=10.0.18362.0
UniversalCRTSdkDir=C:\Program Files (x86)\Windows Kits\
USERDOMAIN=DESKTOP-257N8M8
USERDOMAIN_ROAMINGPROFILE=DESKTOP-257N8M8
USERNAME=mihac
USERPROFILE=C:\Users\mihac
VCIDEInstallDir=C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\VC\
VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\
VCToolsInstallDir=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\
VCToolsRedistDir=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Redist\MSVC.28.29325\
VCToolsVersion=14.28.29333
VisualStudioVersion=16.0
VS160COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\Tools\
VSCMD_ARG_app_plat=Desktop
VSCMD_ARG_HOST_ARCH=x64
VSCMD_ARG_TGT_ARCH=x64
VSCMD_VER=16.8.3
VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio19\Community\
windir=C:\Windows
WindowsLibPath=C:\Program Files (x86)\Windows Kits\UnionMetadata.0.18362.0;C:\Program Files (x86)\Windows Kits\References.0.18362.0
WindowsSdkBinPath=C:\Program Files (x86)\Windows Kits\bin\
WindowsSdkDir=C:\Program Files (x86)\Windows Kits\
WindowsSDKLibVersion=10.0.18362.0\
WindowsSdkVerBinPath=C:\Program Files (x86)\Windows Kits\bin.0.18362.0\
WindowsSDKVersion=10.0.18362.0\
WindowsSDK_ExecutablePath_x64=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\
WindowsSDK_ExecutablePath_x86=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\
__DOTNET_ADD_64BIT=1
__DOTNET_PREFERRED_BITNESS=64
__VSCMD_PREINIT_PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;D:\Apps\bin;C:\Program Files (x86)\dotnet\;C:\Users\mihac\AppData\Local\Programs\Python\Python310;C:\Users\mihac\AppData\Local\Programs\Python\Python310\Scripts;C:\Users\mihac\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\mihac\AppData\Local\Programs\Python\Python310\;C:\Users\mihac\AppData\Local\Microsoft\WindowsApps;C:\Users\mihac\AppData\Local\Programs\Microsoft VS Code\bin;D:\Apps\php5;D:\Apps\php5\ext;C:\cygwin64\bin;
__VSCMD_script_err_count=0
如果您想使用 Cygwin 的编译器在 windows 上构建,您需要 运行 通过 Cygwin 的 python 的 SCons,从 Cygwin 的 shell。
否则默认使用windows编译器、文件路径分隔符等
另外一个旁注,最好叫
env = Environment(tools = ['g++', 'link'])
而不是
env = DefaultEnvironment(tools = ['g++', 'link'])
如果您想在 cygwin 上构建,还需要更改许多其他项目。
如果您在 windows 平台上构建,使用 mingw 或 msvc 可能会更好。
我正在尝试在 Scons 中编译一个 C++ 程序。对于 C++,它给出以下错误:
o Untitled_game_godot\bin\win64\libgd.dll -shared -Lgodot-cpp\bin -llibgodot-cpp.windows.debug.64
o not recognized as an internal command
我试过改变
env.Replace(CXX = "C:/cygwin/bin/")
要么
env.Replace(CXX = "C:/cygwin/bin/g++.exe")
但它没有帮助。
谁知道这件事,谁能帮我解决这个问题?
我在下面附上了我的 Scons 文件、工作目录和环境变量
构建
#!python
import os, subprocess
opts = Variables([], ARGUMENTS)
# Gets the standard flags CC, CCX, etc.
env = DefaultEnvironment(tools = ['g++', 'link'])
#env.Replace(CXX = "compiler/g++.exe")
# Define our options
opts.Add(EnumVariable('target', "Compilation target", 'debug', ['d', 'debug', 'r', 'release']))
opts.Add(EnumVariable('platform', "Compilation platform", '', ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx']))
opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no'))
opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'Untitled_game_godot/bin/'))
opts.Add(PathVariable('target_name', 'The library name.', 'libgd', PathVariable.PathAccept))
# Local dependency paths, adapt them to your setup
godot_headers_path = "godot-cpp/godot-headers/"
cpp_bindings_path = "godot-cpp/"
cpp_library = "libgodot-cpp"
# only support 64 at this time..
bits = 64
# Updates the environment with the option variables.
opts.Update(env)
# Process some arguments
if env['use_llvm']:
env['CC'] = 'clang'
env['CXX'] = 'clang++'
if env['p'] != '':
env['platform'] = env['p']
if env['platform'] == '':
print("No valid target platform selected.")
quit();
# Check our platform specifics
if env['platform'] == "osx":
env['target_path'] += 'osx/'
cpp_library += '.osx'
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS = ['-g','-O2', '-arch', 'x86_64', '-std=c++17'])
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
else:
env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64', '-std=c++17'])
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
elif env['platform'] in ('x11', 'linux'):
env['target_path'] += 'x11/'
cpp_library += '.linux'
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS = ['-fPIC', '-g3','-Og', '-std=c++17'])
else:
env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++17'])
elif env['platform'] == "windows":
env['target_path'] += 'win64/'
cpp_library += '.windows'
# This makes sure to keep the session environment variables on windows,
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
env.Append(ENV = os.environ)
env.Append(CCFLAGS = ['-DWIN32', '-D_WIN32', '-D_WINDOWS', '-W3', '-GR', '-D_CRT_SECURE_NO_WARNINGS'])
if env['target'] in ('debug', 'd'):
env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '-MDd'])
else:
env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '-MD'])
if env['target'] in ('debug', 'd'):
cpp_library += '.debug'
else:
cpp_library += '.release'
cpp_library += '.' + str(bits)
# make sure our binding library is properly includes
env.Append(CPPPATH=['.', godot_headers_path, cpp_bindings_path + 'include/', cpp_bindings_path + 'include/core/', cpp_bindings_path + 'include/gen/'])
env.Append(LIBPATH=[cpp_bindings_path + 'bin/'])
env.Append(LIBS=[cpp_library])
# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=['src/'])
sources = Glob('src/*.cpp')
library = env.SharedLibrary(target=env['target_path'] + env['target_name'] , source=sources)
Default(library)
# Generates help for the -h scons option.
Help(opts.GenerateHelpText(env))
工作树
.
├── Untitled_game_godot
│ ├── UI
│ │ └── main_menu
│ └── bin
│ └── win64
└── godot-cpp
├── __pycache__
├── bin
├── godot-headers
│ ├── android
│ ├── arvr
│ ├── gdnative
│ ├── images
│ │ └── faq
│ ├── nativescript
│ ├── net
│ ├── pluginscript
│ └── videodecoder
├── include
│ ├── core
│ └── gen
├── misc
│ ├── ci
│ ├── hooks
│ └── scripts
├── src
│ ├── core
│ └── gen
└── test
└── src
所有环境变量:
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\mihac\AppData\Roaming
CL=C:\cygwin64\bin\cl.exe
CommandPromptType=Native
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=DESKTOP-257N8M8
ComSpec=C:\Windows\system32\cmd.exe
DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\
DriverData=C:\Windows\System32\Drivers\DriverData
ExtensionSdkDir=C:\Program Files (x86)\Microsoft SDKs\Windows Kits\ExtensionSDKs
Framework40Version=v4.0
FrameworkDir=C:\Windows\Microsoft.NET\Framework64\
FrameworkDir64=C:\Windows\Microsoft.NET\Framework64\
FrameworkVersion=v4.0.30319
FrameworkVersion64=v4.0.30319
HOMEDRIVE=C:
HOMEPATH=\Users\mihac
HTMLHelpDir=C:\Program Files (x86)\HTML Help Workshop
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\ATLMFC\include;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\include;C:\Program Files (x86)\Windows Kits\NETFXSDK.8\include\um;C:\Program Files (x86)\Windows Kits\include.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\include.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\include.0.18362.0\um;C:\Program Files (x86)\Windows Kits\include.0.18362.0\winrt;C:\Program Files (x86)\Windows Kits\include.0.18362.0\cppwinrt
LIB=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\lib.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\lib.0.18362.0\um\x64
LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\ATLMFC\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\lib\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\UnionMetadata.0.18362.0;C:\Program Files (x86)\Windows Kits\References.0.18362.0;C:\Windows\Microsoft.NET\Framework64\v4.0.30319
LOCALAPPDATA=C:\Users\mihac\AppData\Local
LOGONSERVER=\DESKTOP-257N8M8
NETFXSDKDir=C:\Program Files (x86)\Windows Kits\NETFXSDK.8\
NUMBER_OF_PROCESSORS=12
OneDrive=C:\Users\mihac\OneDrive
OneDriveConsumer=C:\Users\mihac\OneDrive
OS=Windows_NT
Path=C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\Extensions\Microsoft\IntelliCode\CLI;C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio19\Community\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\x64;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019\;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Windows Kits\bin.0.18362.0\x64;C:\Program Files (x86)\Windows Kits\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio19\Community\MSBuild\Current\Bin;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\Tools\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;D:\Apps\bin;C:\Program Files (x86)\dotnet\;C:\Users\mihac\AppData\Local\Programs\Python\Python310;C:\Users\mihac\AppData\Local\Programs\Python\Python310\Scripts;C:\Users\mihac\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\mihac\AppData\Local\Programs\Python\Python310\;C:\Users\mihac\AppData\Local\Microsoft\WindowsApps;C:\Users\mihac\AppData\Local\Programs\Microsoft VS Code\bin;D:\Apps\php5;D:\Apps\php5\ext;C:\cygwin64\bin;;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Platform=x64
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=9e0a
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
PYTHONPATH=C:\Users\mihac\AppData\Local\Programs\Python\Python310
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\mihac\AppData\Local\Temp
TMP=C:\Users\mihac\AppData\Local\Temp
UCRTVersion=10.0.18362.0
UniversalCRTSdkDir=C:\Program Files (x86)\Windows Kits\
USERDOMAIN=DESKTOP-257N8M8
USERDOMAIN_ROAMINGPROFILE=DESKTOP-257N8M8
USERNAME=mihac
USERPROFILE=C:\Users\mihac
VCIDEInstallDir=C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\IDE\VC\
VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\
VCToolsInstallDir=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.28.29333\
VCToolsRedistDir=C:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Redist\MSVC.28.29325\
VCToolsVersion=14.28.29333
VisualStudioVersion=16.0
VS160COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio19\Community\Common7\Tools\
VSCMD_ARG_app_plat=Desktop
VSCMD_ARG_HOST_ARCH=x64
VSCMD_ARG_TGT_ARCH=x64
VSCMD_VER=16.8.3
VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio19\Community\
windir=C:\Windows
WindowsLibPath=C:\Program Files (x86)\Windows Kits\UnionMetadata.0.18362.0;C:\Program Files (x86)\Windows Kits\References.0.18362.0
WindowsSdkBinPath=C:\Program Files (x86)\Windows Kits\bin\
WindowsSdkDir=C:\Program Files (x86)\Windows Kits\
WindowsSDKLibVersion=10.0.18362.0\
WindowsSdkVerBinPath=C:\Program Files (x86)\Windows Kits\bin.0.18362.0\
WindowsSDKVersion=10.0.18362.0\
WindowsSDK_ExecutablePath_x64=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\
WindowsSDK_ExecutablePath_x86=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\
__DOTNET_ADD_64BIT=1
__DOTNET_PREFERRED_BITNESS=64
__VSCMD_PREINIT_PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;D:\Apps\bin;C:\Program Files (x86)\dotnet\;C:\Users\mihac\AppData\Local\Programs\Python\Python310;C:\Users\mihac\AppData\Local\Programs\Python\Python310\Scripts;C:\Users\mihac\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\mihac\AppData\Local\Programs\Python\Python310\;C:\Users\mihac\AppData\Local\Microsoft\WindowsApps;C:\Users\mihac\AppData\Local\Programs\Microsoft VS Code\bin;D:\Apps\php5;D:\Apps\php5\ext;C:\cygwin64\bin;
__VSCMD_script_err_count=0
如果您想使用 Cygwin 的编译器在 windows 上构建,您需要 运行 通过 Cygwin 的 python 的 SCons,从 Cygwin 的 shell。
否则默认使用windows编译器、文件路径分隔符等
另外一个旁注,最好叫
env = Environment(tools = ['g++', 'link'])
而不是
env = DefaultEnvironment(tools = ['g++', 'link'])
如果您想在 cygwin 上构建,还需要更改许多其他项目。
如果您在 windows 平台上构建,使用 mingw 或 msvc 可能会更好。