1. before you start
build the lib, then compile a file of your own against it
by the end of this page the lib is built and you have a main.cpp of your own that compiles. it does
nothing yet, that is page 2
build the lib
on mac you need the xcode command line tools, xcode-select --install if you have never run it. then
from cpp/
make
make runon windows you need vs2022 with the desktop development with c++ workload. then from cpp\
build.bat| the libs land in | |
|---|---|
| mac | cpp/bin/macos_Debug/ |
| windows | cpp\bin\x64_Debug\ |
on mac, make run opens the demo window, and if it opens the lib is good. if either build fails,
building it and what it needs have the long version
make your own file
a new folder anywhere, outside the lib, with one file in it
//
// my first window
//
int main()
{
return 0;
}compile it
every page after this uses the same command, so it is worth getting right once. swap the path for wherever the lib lives on your machine
on mac, from your folder
GUI=~/path/to/gui-lib/cpp
clang++ -std=c++20 -I$GUI/window.core main.cpp $GUI/bin/macos_Debug/libwindow.core.a $GUI/bin/macos_Debug/libblend2d.a -framework Cocoa -framework QuartzCore -framework CoreText -framework CoreGraphics -o my-appon windows, from the x64 native tools command prompt for vs 2022, a plain prompt has no cl in it
set GUI=C:\path\to\gui-lib\cpp
cl /std:c++20 /EHsc /MTd /DWIN32_LEAN_AND_MEAN /DNOMINMAX /DUNICODE /D_UNICODE /I "%GUI%\window.core" main.cpp "%GUI%\bin\x64_Debug\window.core.lib" "%GUI%\bin\x64_Debug\blend2d.lib" user32.lib gdi32.lib dwmapi.lib
/MTdhas to match the lib, it was built against the static debug runtime, and a mismatch is a wall of linker errors that never once says the word runtime
you should see no errors, and my-app runs and exits straight away