[转]:如何快速构建一个简单的程序

发布于:2023-03-27 ⋅ 阅读:(294) ⋅ 点赞:(0)
试读部分
首先我们通过内置的工程模板创建一个空工程: $ xmake create -P ./hello create hello ... create ok!? 这个时候xmake将会产生一些工程文件,如下: $ cd ./hello $ tree . . ├── src │   └── main.c └── xmake.lua 这个简单的程序仅仅只是为了打印输出: hello xmake! $ cat ./src/main.c #include <stdio.h> int main(int argc, char** argv) { printf("hello xmake!\n"); return 0; } xmake.lua是基于lua语法的工程描述文件,它很简单: $ cat xmake.lua target("hello") set_kind("binary") add_files("src/*.c") 现在我们开始编译这个程序 $ xmake checking for the architecture ... x86_64 checking for the Xcode SDK version for macosx ... 10.11 checking for the target minimal version ... 10.11 checking for the c compiler (cc) ... xcrun -sdk macosx clang checking for the c++ compiler (cxx) ... xcrun -sdk macosx clang checking for the objc compiler (mm) ... xcrun -sdk macosx clang checking fo……
本文为 VIP 文章,已展示部分内容,开通 VIP 后查看全文

觉得这篇文章有帮助?

点个赞,或赞赏支持作者持续创作

微信公众号

今日签到

点亮在社区的每一天
去签到