创建项目
安装编程环境
下载仓颉编译器,注意不要放在中文目录下,可能会报错。添加到系统环境变量(windows),参考文档-仓颉编程语言官网
命令行查看编译器版本:
$ cjc --version
Cangjie Compiler: 0.53.18 (cjnative)
Target: x86_64-w64-mingw32
创建项目
项目文件夹的名称就是项目的名称。
进入项目文件夹下,打开命令行工具,输入cjpm init
初始化项目。
cjpm是仓颉语言的包管理工具,用法如下:
Cangjie Package Manager
Usage:
cjpm [subcommand] [option]
Available subcommands:
init Init a new cangjie module
check Check the dependencies
update Update cjpm.lock
tree Display the package dependencies in the source code
build Compile the current module
run Compile and run an executable product
test Unittest a local package or module
clean Clean up the target directory
install Install a cangjie binary
uninstall Uninstall a cangjie binary
Available options:
-h, --help help for cjpm
-v, --version version for cjpm
Use "cjpm [subcommand] --help" for more information about a command.
进入项目目录,就是包含cjpm.toml文件的路径,这是项目的根目录。
输入cjpm run
直接运行,输入cjpm build
编译并生成可执行文件。