FlagMaker
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 使用 VSCode 開發 C/C++ 程式 如果想要使用 VSCode(Visual Studio Code)開發 C/C++ 程式,只要進行簡單的設定就可以,請依照以下說明設定。 ## 安裝 VSCode 首先安裝 VSCode: 1. 請連至 https://code.visualstudio.com/download 下載並安裝 VScode。 2. 安裝完成後執行 VSCode: ![圖片](https://hackmd.io/_uploads/BkAJEIfw1g.png) 依照上述步驟按**延伸模組**鈕後鍵入 "chinese" 搜尋,在 **Chinese(Traditional)Language Pack for Visual Studio Code** 項目按 **Install** 安裝繁體中文延伸模組,將介面更改為繁體中文阪本: ![圖片](https://hackmd.io/_uploads/HJDS4LMPJe.png) 按 **Change Language and Restart** 更改語言設定並重新啟動 VSCode。 3. 安裝 C/C++ 延伸模組: ![圖片](https://hackmd.io/_uploads/rkosE8MPJl.png) 依照上述步驟按**延伸模組**鈕後鍵入 "C" 搜尋,在 **C/C++ Extension Pack** 項目右側按 **Install** 安裝: ![圖片](https://hackmd.io/_uploads/HJoyULMw1l.png) 這個延伸模組會連帶安裝 **C/C++** 以及 **C/C++ Theme** 兩個模組。 4. 安裝完即可關閉 VSCode。 ## 安裝 C/C++ 編譯器 Windows 平台本身並沒有提供 C/C++ 編譯器,必須另行安裝。以下以免安裝只要解開壓縮檔的 [WinLibs](https://winlibs.com) 為例,說明安裝步驟: 1. 請連至 https://winlibs.com/#download-release : ![圖片](https://hackmd.io/_uploads/SJ9Q8sEPJg.png) 點選 64 位元 ZIP 版本下載後解壓縮: ![圖片](https://hackmd.io/_uploads/SJDt8sEPkl.png) 本例解壓縮到 C:\ 下。 2. 設定環境變數,以便能直接使用編譯器相關指令。請先按 <kbd>🪟+R</kbd> 開啟**執行**視窗: ![圖片](https://hackmd.io/_uploads/SJZlDsVvkl.png) 鍵入 "control system" 按**確定**開啟**系統**視窗: ![圖片](https://hackmd.io/_uploads/r1u9PjNDke.png) 按**進階系統設定**: ![圖片](https://hackmd.io/_uploads/rkvpPiVPyg.png) 按**環境變數**: ![圖片](https://hackmd.io/_uploads/SJbg_i4Pyg.png) 在**使用者環境變數**窗格往下捲動找到 **Path** 項目後按**編輯**: ![圖片](https://hackmd.io/_uploads/BkFVui4D1x.png) 按**新增**: ![圖片](https://hackmd.io/_uploads/Sk0UuoVPJg.png) 輸入剛剛解壓縮的路徑,加上 "\bin",例如前面我解壓縮倒 C:\ 下,所以完整的路徑就是 "C:\mingw64\bin"。輸入後一路按**確定**完成設定。 3. 測試安裝好的 C/C++ 編譯器,請重新開啟 VSCode: ![圖片](https://hackmd.io/_uploads/HyxetsNwJx.png) 執行『**檢視/終端**』功能表指令在 VSCode 中開啟終端機窗格: ![圖片](https://hackmd.io/_uploads/SJp4FjNDJx.png) 依照圖中分別執行 `gcc --version`、`g++ --version`、`gdb --version` 三個顯示個別工具版本的指令,如果都可以看到版本編號,表示安裝正確無誤。 ## 測試編譯/執行 C/C++ 程式 1. 使用 VSCode 編輯、編譯與執行 C/C++ 程式: ![圖片](https://hackmd.io/_uploads/rJYRd8zD1l.png) 執行『**檔案/開啟資料夾**』功能表命令: ![圖片](https://hackmd.io/_uploads/B12y5oVwJe.png) 瀏覽至你要撰寫程式的位置,建立一個新的資料夾,本例命名為 "cpp",請確認整體路徑上都沒有包含有中文的資料夾,按**選擇資料夾**開啟: ![圖片](https://hackmd.io/_uploads/H1dG5s4v1g.png) 按**是,我信任作者**,稍後才能執行編譯功能: ![圖片](https://hackmd.io/_uploads/B1jI5i4vJl.png) 按左側**檔案總管**後再按工具列中的**新增檔案**鈕: ![圖片](https://hackmd.io/_uploads/ryCdqjEwyg.png) 輸入檔名,本例為 "test.cpp": ![圖片](https://hackmd.io/_uploads/rk52ciVD1g.png) 輸入測試的 C++ 程式碼後按右上角向下的箭頭展開執行選項,選取 **Run C/C++ File**: ![圖片](https://hackmd.io/_uploads/BJAAqoEw1l.png) 首次編譯執行程式會出現組態清單,由於我們安裝的是 GCC 編譯器,這裡請選 **C/C++:g++.exe**: ![圖片](https://hackmd.io/_uploads/Bkx-ooVwyx.png) 接著就會自動編譯程式碼,如果程式碼沒有語法錯誤,就可以成功編譯,並自動執行程式,應該會看到程式的執行結束碼為 0: ![圖片](https://hackmd.io/_uploads/HkNXijEDyx.png) 要實際看到程式執行結果,必須切換到**終端機**頁次,就會看到剛剛程式執行後輸出的 "Hello, world." 了。 這樣,就可以使用 VSCode 開發 C/C++ 了。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully