# First Meson Build on Ubuntu ### --prepare & reference-- > github: https://github.com/mesonbuild/meson > > Need: > Python 3.5+ > Ninja 1.5+ > > Installing: see github's *Installing from source* > > Tutorial: https://mesonbuild.com/Tutorial.html ### --First program build by meson-- *-main.cpp-* <pre> #include <iostream> int main(){ std::cout << "first print~~" << std::endl; return 0; } </pre> *-meson.build-* <pre> project('firstmeson', 'cpp') executable('testmeson', 'main.cpp') </pre> #### --build step-- 1. meson builddir 2. cd builddir 3. ninja -> generate exec file 4. ./testmeson #### -test exec- **if want to use ninja test(test before execute code to see errors) modify meson.build <pre> project('tutorial', 'cpp') exec = executable('testmeson', 'main.cpp') test('simple test', exec) </pre> and command under builddir <pre>ninja test</pre> test result will like this: <pre><font color="#8AE234"><b>harvey@harvey-desktop</b></font>:<font color="#729FCF"><b>~/recipes-demo/testmeson/build</b></font>$ ninja test [0/1] Running all tests. 1/1 simple test OK 0.00 s Ok: 1 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0 Full log written to /home/harvey/recipes-demo/testmeson/build/meson-logs/testlog.txt </pre>