Windowsバッチスクリプトを使用してCプログラムをビルドしたいが、コンパイラが致命的なエラーになる。WindowsバッチスクリプトからCプログラムをビルドできません
私はWindows 10のコンピュータとMicrosoft C/C++コンパイラを使用しています。私が実行しています
バッチスクリプトがbuild.bat
と呼ばれ、内容は次のとおりです。
SET PROJECT_COMPILER=cl
SET HOME_DIRECTORY=%~dp0
SET PROJECT_SRC=%HOME_DIRECTORY%src\
SET PROJECT_BIN=%HOME_DIRECTORY%bin\
SET PROJECT_INCLUDE=%HOME_DIRECTORY%include\
%PROJECT_COMPILER% "%PROJECT_SRC%*.c" /I"%PROJECT_INCLUDE%" /link
/out:"%PROJECT_BIN%out.exe"
del /f .\*.obj
と私はライン%PROJECT_COMPILER% "%PROJECT_SRC%*.c" /I"%PROJECT_INCLUDE%" /link /out:"%PROJECT_BIN%out.exe"
から取得出力は次のとおりです。
C:\Users\Andrea Nardi\Documents\C project\test_project>cl "C:\Users\Andrea Nardi\Documents\C project\test_project\src\*.c"
/I"C:\Users\Andrea Nardi\Documents\C project\test_project\include\" /link
/out:"C:\Users\Andrea Nardi\Documents\C project\test_project\bin\out.exe"
Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25507.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9024 : unrecognized source file type
'Nardi\Documents\C', object file assumed
cl : Command line warning D9024 : unrecognized source file type
'project\test_project\bin\out.exe', object file assumed
main.c
Microsoft (R) Incremental Linker Version 14.11.25507.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
Nardi\Documents\C
project\test_project\bin\out.exe
LINK : fatal error LNK1181: cannot open input file 'Nardi\Documents\C.obj'
何かがディレクトリ名のスペースを壊しています。 – melpomene