C++ example
By default starbuild comes with a C++ plugin! To get started create a new project by running starbuild init
. Then uncomment the lines in starbuild.lua for the C++ plugin. Your starbuild file should now look like
-- Starbuild config file, generated by 'starbuild init'
-- all config must be in the Config function
local star = {}
-- when starbuild runs this function, it will pass in a table with starbuild functions in it.
function star.Config(starbuild)
-- configure default plugins.
-- set plugins. Uncomment the one for your language.
-- C/C++
starbuild.LoadPlugin('DEFAULT_CPP')
starbuild.RunPluginTrigger('CPPBuild', { 'foo.hpp', 'foo.cpp' })
end
-- return config
return star
Now you need to learn a little bit of lua. Remove all of the files names from the trigger functionm or just replace the trigger function with whats below
starbuild.RunPluginTrigger('CPPBuild', { })
Now to test starbuild I just added a hello_world.cpp file to the list, now it looks like this
starbuild.RunPluginTrigger('CPPBuild', { 'hello_world.cpp' })
Great! Now we are ready to run our build! To run our build simply run starbuild run
in your terminal, after the build completes we can now see an a.out
file in the current folder. To run our program just do
./a.out
Thats a quick intro to starbuilds C++ plugin!