# 教學 ## 安裝WSL 請參考 https://hackmd.io/@Kailyn/BkMi80IeF ## 安裝 WSL-UBUNTU 按下`win+r`並輸入`cmd`來打開 terminal 在cmd上輸入 `wsl --install -d ubuntu` 等待下載完成,並輸入要使用的username以及password就可以進入wsl了 ``` C:\Users\JorJor-Win10>wsl --install -d ubuntu 安裝: Ubuntu Ubuntu 已安裝。 正在啟動 Ubuntu... Installing, this may take a few minutes... Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: https://aka.ms/wslusers Enter new UNIX username: jorjor New password: Retype new password: passwd: password updated successfully Installation successful! ``` ## 下載專案 打開vscode 右上方有Terminal,點擊New Terminal ![image](https://hackmd.io/_uploads/BJq4kVsXR.png) 把專案用git抓到電腦桌面 ``` cd Desktop git clone https://github.com/usnistgov/SP800-90B_EntropyAssessment.git ``` 把抓下來的專案打開 (C:\Users\JorJor-Win10\Desktop\SP800-90B_EntropyAssessment) ![image](https://hackmd.io/_uploads/B1lOnG4oXC.png) ## 打開WSL-UBUNTU 右上方有Terminal,點擊New Terminal 輸入 `wsl -d Ubuntu` 進入wsl環境,你現在的位置在window上是`C:\Users\JorJor-Win10\Desktop\SP800-90B_EntropyAssessment` ![image](https://hackmd.io/_uploads/BJPrmEim0.png) ## 安裝 gcc/g++/make 以及其他套件 ``` sudo apt udpate -y # 先更新 repo sudo apt install gcc g++ make -y # 安裝 c/c++ compiler sudo apt-get install libbz2-dev libdivsufsort-dev libjsoncpp-dev libssl-dev libmpfr-dev -y # 安裝專案需要的套件 ``` ## 執行 進到 cpp, cpp下有一個makefile ![image](https://hackmd.io/_uploads/B1YjX4omC.png) 在terminal上執行`make`會如下 ![image](https://hackmd.io/_uploads/SJceVNjm0.png) 以下是Makefile ![image](https://hackmd.io/_uploads/SybmNEj7R.png) makefile 只是爲了方便管理許多不同的指令,可能一個專案需要下許多不同的指令之類的 make 指令使用: - 如果只下make,他會預設執行第一個也就是all, 等同在terminal下`make all` - 如果需要下其他的,則在terminal下`make xxx`就好 - 舉例1:我要執行iid,則在terminal下`make iid` - 舉例2:我清除產生出來的文件,則在terminal下`make clean` - 更多makefile裏面的指令請查看github的readme文件