====== CDT ======
* description : Eclipse에서 c, cplusplus 개발 방법 기술
* author : 주레피
* email : dhan@repia.com
* lastupdate : 2020-05-19
===== 설치 =====
[[https://www.bogotobogo.com/cplusplus/eclipse_CDT_JNI_MinGW_64bit.php|ECLIPSE CDT & JNI (JAVA NATIVE INTERFACE) WITH 64 BIT MINGW - 2020]] \\
===== 강좌 =====
[[https://www.youtube.com/playlist?list=PL-suslzEBiMrqFeagWE9MMWR9ZiYgWq89|Linux C Programming]] \\
[[https://www.youtube.com/watch?v=DIaRhRgNfx4|Importing C Code Files Into Eclipse]] \\
===== Cross GCC vs Linux GCC(Native) =====
컴파일한 바이너리가 다른 곳에서도 사용 가능
===== C/Cplusplus 개발 =====
==== library 등록(pthread, socket, 사용자 정의 라이브러리) =====
- Project -> Properties
- C/Cplusplus Build -> Settings
- Tool Settings -> GCC Linker -> Libraries
pthread, iconv 처럼 해야됨 \\
[[https://wookiist.tistory.com/76|[Wiki] Ubuntu 환경의 Eclipse CDT에서 thread 사용시 undefined references with pthread create 가 뜨는 경우 해결 방법]]
==== -fPIC 등록 ====
- Project -> Properties
- C/Cplusplus Build -> Settings
- Tool Settings -> GCC Compiler -> Miscellaneous
- Position Independent Code (-fPIC) check!!
==== Makefile 자동생성 ====
- Project -> Properties
- C/Cplusplus Build
- Builder Settings -> Makefile generation
Generate Makefiles automatically 체크 후 Apply \\
==== 소스 폴더 지정 ====
- Project -> Properties
- C/Cplusplus General -> Paths and Symbols
- Source Location
==== 실행파일 종류 지정 ====
- Project -> Properties
- C/Cplusplus Build -> Settings
- Build Artifact
Artifact Type: 선택박스에서 Executable | Shared Library | Static Library 중 하나 지정 \\
==== 출력파일 지정 ====
- Project -> Properties
- C/Cplusplus General -> Paths and Symbols
- Output Location
==== 코드 스타일 지정(Formatter) =====
- Windows -> Preferences
- C/Cplusplus -> Code Style -> Formatter
- BSD/Allman 사용
- Mouse right click -> Source -> Format 실행
===== Tip =====
[[https://youtu.be/UQ-QrdwjHMw|Detecting Memory Leaks With Valgrind]] \\
===== Troubleshooting =====
===== Ref =====
{{tag>주레피 cdt mingw dbcp}}