{"id":8486,"date":"2024-02-01T14:00:54","date_gmt":"2024-02-01T05:00:54","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=8486"},"modified":"2024-07-02T13:22:34","modified_gmt":"2024-07-02T04:22:34","slug":"c-vscode-with-wsl2-on-windows-10","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=8486","title":{"rendered":"C++ &#8211; VSCode with WSL2 on Windows 10"},"content":{"rendered":"<h1>C++ &#8211; VSCode with WSL2 on Windows 10<\/h1>\n<p>\uc708\ub3c4\uc6b0 \ud658\uacbd\uc5d0\uc11c gcc \ub97c \uc774\uc6a9\ud558\uae30 \uc704\ud574 MinGW \ub97c \uc774\uc6a9\ud558\ub294 \ubc29\ubc95\ub3c4 \uc788\uc9c0\ub9cc,<br \/>\nWSL2 \ub97c \uc774\uc6a9\ud574 Ubuntu gcc \ub97c \uc774\uc6a9\ud558\ub294 \ubc29\ubc95\uc744 \uc124\uba85\ud569\ub2c8\ub2e4.<\/p>\n<h2>WSL2 \uc124\uce58<\/h2>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=8347\">\uc5ec\uae30<\/a><\/p>\n<p>\uc704 \ub9c1\ud06c\ub97c \ucc38\uc870\ud558\uc5ec WSL2 \ub97c \uc124\uce58\ud574 \uc90d\ub2c8\ub2e4.<\/p>\n<h2>VSCode Extension \uc124\uce58<\/h2>\n<p>Remote &#8211; WSL Extension \uc744 \uc124\uce58\ud574 \uc90d\ub2c8\ub2e4.<br \/>\nWSL \uc744 \uac80\uc0c9\uc5b4\ub85c \uc785\ub825\ud558\uba74 \ucc3e\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<br \/>\n\ub610\ub294 Remote Development \ub97c \uc785\ub825\ud574 \uc6d0\uaca9\ud234 \uc5ec\ub7ec\uac1c\ub97c \ub3d9\uc2dc\uc5d0 \uc124\uce58\ud560 \uc218\ub3c4 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<h2>WSL \uc811\uc18d<\/h2>\n<p>VSCode \uc88c\uce21 \ud558\ub2e8\uc5d0 \ucd08\ub85d\uc0c9 \uc544\uc774\ucf58\uc744 \ud074\ub9ad \ud6c4, <code>New WSL Window<\/code> \ub610\ub294 <code>Connect to WSL<\/code> \uc744 \uc120\ud0dd\ud558\uba74 WSL \uc774 \uc2e4\ud589\ub418\uba74\uc11c \ud3f4\ub354\ub97c \uc120\ud0dd\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-02-01-01.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-02-01-01-300x172.png\" alt=\"\" \/><\/a><\/p>\n<p>\ub610\ub294 <code>Connect to WSL using Distro<\/code> \ub97c \uc120\ud0dd\ud574\uc11c \uc6d0\ud558\ub294 \ubc84\uc804\uc758 WSL \uc5d0 \uc811\uc18d\ud560 \uc218\ub3c4 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-01.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-01.png\" alt=\"\" \/><\/a><\/p>\n<h2>\ucef4\ud30c\uc77c\ub7ec \uc124\uce58<\/h2>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-02.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-02.png\" alt=\"\" \/><\/a><\/p>\n<p>\uc704 \ud130\ubbf8\ub110\uc5d0\uc11c \uc544\ub798 \uba85\ub839\uc744 \uc785\ub825\ud574 \ucef4\ud30c\uc77c\ub7ec\ub97c \uc124\uce58\ud574 \uc90d\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-bash\">sudo apt-get update\nsudo apt-get install build-essential gdb\nwhereis g++\nwhereis gdb<\/code><\/pre>\n<h2>\ud504\ub85c\uc81d\ud2b8 \uc624\ud508<\/h2>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-03.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-03.png\" alt=\"\" \/><\/a><\/p>\n<p>\ud504\ub85c\uc81d\ud2b8 \ud3f4\ub354\ub97c \uc0dd\uc131\ud558\uace0 \ud3f4\ub354\ub97c \uc5f4\uc5b4\uc90d\ub2c8\ub2e4.<\/p>\n<p><code>hello.cpp<\/code> \ub77c\ub294 \ud30c\uc77c\uc744 \uc0dd\uc131\ud558\uace0 \uc544\ub798 \ub0b4\uc6a9\uc744 \uc785\ub825\ud574 \uc90d\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-cpp\">#include &lt;stdio.h&gt;\n\nint main() {\n    printf(&quot;hello, world!\\n&quot;);\n}<\/code><\/pre>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-04.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-04.png\" alt=\"\" \/><\/a><\/p>\n<p>extension \uc744 \uc124\uce58\ud558\ub77c\uace0 \ud558\uba74 \uc124\uce58\ud574 \uc90d\ub2c8\ub2e4.<\/p>\n<p><code>F5<\/code> \ub97c \uc785\ub825\ud558\uba74 \uc544\ub798\uc640 \uac19\uc740 \ud31d\uc5c5\uc774 \ub728\uace0, gcc \ub610\ub294 g++ \ub97c \uc120\ud0dd\ud574 \uc90d\ub2c8\ub2e4.<\/p>\n<p><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-05.png\"><img decoding=\"async\" src=\"https:\/\/www.skyer9.pe.kr\/wordpress\/wp-content\/uploads\/2024\/02\/2024-07-02-05.png\" alt=\"\" \/><\/a><\/p>\n<h2>Makefile<\/h2>\n<p>hello_function.h<\/p>\n<pre><code class=\"language-cpp\">void hello_function();<\/code><\/pre>\n<p>hello_function.cpp<\/p>\n<pre><code class=\"language-cpp\">#include &lt;stdio.h&gt;\n#include &quot;hello_function.h&quot;\n\nvoid hello_function() {\n    printf(&quot;hello, world!\\n&quot;);\n}<\/code><\/pre>\n<p>hello.cpp<\/p>\n<pre><code class=\"language-cpp\">#include &lt;stdio.h&gt;\n#include &quot;hello_function.h&quot;\n\nint main() {\n    hello_function();\n}<\/code><\/pre>\n<p>Makefile<\/p>\n<pre><code class=\"language-makefile\">CC = g++\nCFLAGS = -c -g\nLDFLAGS =\nOBJECTS = hello.o hello_function.o\n\nrun: all\n    program\n\nall: program\n\nprogram : $(OBJECTS)\n    $(CC)  $(LDFLAGS) -o hello $(OBJECTS)\n\nmain.o : main.cpp\n    $(CC) $(CFLAGS) main.cpp\n\nhello_function.o : hello_function.cpp\n    $(CC) $(CFLAGS) hello_function.cpp\n\nclean:\n    rm -f *.o\\\n\n.PHONY: all bonus clean fclean re<\/code><\/pre>\n<p>\uc704\uc640 \uac19\uc774 \ud30c\uc77c\uc744 \uc0dd\uc131 \ubc0f \uc218\uc815\ud569\ub2c8\ub2e4.<br \/>\nMakefile \uc5d0\uc11c \ub4e4\uc5ec\uc4f0\uae30\ub294 \ubc18\ub4dc\uc2dc TAB \ubb38\uc790\uc5ec\uc57c \ud569\ub2c8\ub2e4.<\/p>\n<p>Ctrl-&#96; (\ud0a4\ubcf4\ub4dc \uc22b\uc790 1 \uc606\uc5d0 \ubb38\uc790) \uc744 \uc785\ub825\ud574\uc11c \ud130\ubbf8\ub110\uc744 \uc5f4\uace0 <code>make all<\/code> \ub97c \uc2e4\ud589\ud569\ub2c8\ub2e4.<\/p>\n<pre><code class=\"language-bash\">make all<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>C++ &#8211; VSCode with WSL2 on Windows 10 \uc708\ub3c4\uc6b0 \ud658\uacbd\uc5d0\uc11c gcc \ub97c \uc774\uc6a9\ud558\uae30 \uc704\ud574 MinGW \ub97c \uc774\uc6a9\ud558\ub294 \ubc29\ubc95\ub3c4 \uc788\uc9c0\ub9cc, WSL2 \ub97c \uc774\uc6a9\ud574 Ubuntu gcc \ub97c \uc774\uc6a9\ud558\ub294 \ubc29\ubc95\uc744 \uc124\uba85\ud569\ub2c8\ub2e4. WSL2 \uc124\uce58 \uc5ec\uae30 \uc704 \ub9c1\ud06c\ub97c \ucc38\uc870\ud558\uc5ec WSL2 \ub97c \uc124\uce58\ud574 \uc90d\ub2c8\ub2e4. VSCode Extension \uc124\uce58 Remote &#8211; WSL Extension \uc744 \uc124\uce58\ud574 \uc90d\ub2c8\ub2e4. WSL \uc744 \uac80\uc0c9\uc5b4\ub85c \uc785\ub825\ud558\uba74 \ucc3e\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=8486\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"class_list":["post-8486","post","type-post","status-publish","format-standard","hentry","category-c-c"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/8486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8486"}],"version-history":[{"count":8,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/8486\/revisions"}],"predecessor-version":[{"id":9123,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/8486\/revisions\/9123"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}