Сборка / Build
Сборка проекта
Сборка и запуск программы происходит по нажатию одной кнопки или сочетанию клавиш, что обычно удобнее, чем из командной строки. Если на одном из этапов сборки произошла ошибка, то сообщение о ней можно будет увидеть в окне "Output" или "Build output". Если при запуске сборки программы в IDE были открыты файлы с несохраненными изменениями, то они автоматически сохраняются перед сборкой.
Обратим внимание, что в Visual Studio есть два отдельных объекта: решение или solution и проект или project (одно из них является подмножеством другого). Если в решении (solution) хранится один проект (project), то можно использовать:
для сборки сочетание клавиш, по умолчанию,
F7для пересборки сочетание клавиш, по умолчанию,
CTRL+ALT+F7
В ином случае же, когда проектов несколько и есть необходимость собрать/пересобрать только один из них, то нужно нажать ПКМ по названию проекта в Solution Explorer и выбрать в контекстном меню Build или Rebuild.

По умолчанию, в CLion горячей клавишей для сборки проекта является сочетание CTRL + F9.
Существует также альтернативный вариант в виде кнопки в виде молоточка или через кнопку Build.
В старом интерфейсе:

В новом интерфейсе:

Результаты сборки проекта / Build log
Обычно в адекватных IDE окно, что вещает нам о логах сборки проекта, называется или Output, или Build output или же Error List - там будет отображаться лог сборки. Мы разберём несколько примеров того, как может выглядеть лог в IDE.
Место, куда нужно смотреть – Output Window.
1>------ Build started: Project: DebuggingExample, Configuration: Debug x64 ------
1>main.c
1>DebuggingExample.vcxproj -> <path-to-project>\DebuggingExample\x64\Debug\DebuggingExample.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Elapsed 00:00.345 ==========Build started...
1>------ Build started: Project: DebuggingExample, Configuration: Debug x64 ------
1>main.c
1><path-to-project>\DebuggingExample\main.c(17,9): error C2146: syntax error: missing ';' before identifier 'arr2'
1>Done building project "DebuggingExample.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Elapsed 00:00.230 ==========Build started...
1>------ Build started: Project: DebuggingExample, Configuration: Debug Win32 ------
1>Source.c
1><path-to-project>\DebuggingExample\Source.c(12,22): warning C4013: 'bar' undefined; assuming extern returning int
1><path-to-project>\DebuggingExample\Source.c(17,1): warning C4047: 'initializing': 'char' differs in levels of indirection from 'char *'
1><path-to-project>\DebuggingExample\Source.c(18,1): warning C4047: 'initializing': 'char' differs in levels of indirection from 'char *'
1><path-to-project>\DebuggingExample\Source.c(19,1): warning C4047: 'initializing': 'char' differs in levels of indirection from 'char *'
1>Source.obj : error LNK2019: unresolved external symbol _bar referenced in function _foo
1><path-to-project>\DebuggingExample\Debug\DebuggingExample.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "DebuggingExample.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========Место, куда нужно смотреть – Messages-Build.
====================[ Build | DebuggingExample | Debug ]========================
"path-to-cmake\cmake.exe" --build <path-to-project>\DebuggingExample\cmake-build-debug --target DebuggingExample
[1/2] Building C object CMakeFiles/DebuggingExample.dir/main.c.obj
[2/2] Linking C executable DebuggingExample.exe
Build finished ====================[ Build | DebuggingExample | Debug ]========================
"path-to-cmake\cmake.exe" --build <path-to-project>\DebuggingExample\cmake-build-debug --target DebuggingExample
[1/2] Building C object CMakeFiles/DebuggingExample.dir/main.c.obj
FAILED: CMakeFiles/DebuggingExample.dir/main.c.obj
C:\msys64\mingw64\bin\cc.exe -g -fdiagnostics-color=always -std=gnu11 -MD -MT CMakeFiles/DebuggingExample.dir/main.c.obj -MF CMakeFiles\DebuggingExample.dir\main.c.obj.d -o CMakeFiles/DebuggingExample.dir/main.c.obj -c C:/DebuggingExample/main.c
<path-to-project>/DebuggingExample/main.c: In function 'main':
<path-to-project>/DebuggingExample/main.c:5:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'return'
5 | return 0;
| ^~~~~~
ninja: build stopped: subcommand failed. ====================[ Build | DebuggingExample | Debug ]========================
"path-to-cmake\cmake.exe" --build <path-to-project>\DebuggingExample\cmake-build-debug --target DebuggingExample
[1/2] Building C object CMakeFiles/DebuggingExample.dir/main.c.obj
[2/2] Linking C executable DebuggingExample.exe
FAILED: DebuggingExample.exe
cmd.exe /C "cd . && C:\msys64\mingw64\bin\cc.exe -g CMakeFiles/DebuggingExample.dir/main.c.obj -o DebuggingExample.exe -Wl,--out-implib,libDebuggingExample.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/DebuggingExample.dir/main.c.obj: in function `main':
C:/DebuggingExample/main.c:6: undefined reference to `test'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.Last updated