官术网_书友最值得收藏!

Debug and release builds

You may have noticed that the program was in a directory called target/debug. What's that about? By default, cargo builds our program in debug mode, which is what a programmer normally wants.

That means that the resulting program is instrumented to work with the rust-gdb debugging program so we can examine what is happening in its internals, and to provide useful information in crash dumps and such, as well as skipping the compiler's optimization phase. The optimizations are skipped because they rearrange things in such a way that it makes debugging information almost incomprehensible.

However, sometimes a program doesn't have any more bugs (that we know about) and we're ready to ship it out to others. To construct our final, optimized version of the program, we use cargo build --release.

This will construct the release version of the program, and leave it in target/release/foo. We can copy it from there and package it up for distribution.

主站蜘蛛池模板: 互助| 峨边| 韩城市| 绥宁县| 右玉县| 利辛县| 伊川县| 神农架林区| 漠河县| 屏东市| 阳高县| 稻城县| 京山县| 南安市| 鹤壁市| 迁西县| 东丰县| 南郑县| 海林市| 虞城县| 荃湾区| 化德县| 南汇区| 桂林市| 安国市| 自治县| 莱芜市| 沙坪坝区| 盖州市| 唐海县| 彩票| 昌黎县| 清涧县| 迭部县| 永年县| 天水市| 犍为县| 阳原县| 临澧县| 银川市| 芦溪县|