C++ 컴파일을 위한 Makefile 준비
- Development/42 Seoul
- 2021. 12. 11.
- Remember: You are coding in C++ now, not in C anymore. Therefore:
- The following functions are FORBIDDEN, and their use will be punished bya 0, no questions asked: *alloc, *printf and free.
- You are allowed to use basically everything in the standard library. HOWEVER, it would be smart to try and use the C++-ish versions of the functions you are used to in C, instead of just keeping to what you know, this is a new language after all. And NO, you are not allowed to use the STL until you actually are supposed to (that is, until module 08). That means no vec- tors/lists/maps/etc… or anything that requires an include <algorithm> until then.
- Actually, the use of any explicitly forbidden function or mechanic will be punished by a 0, no questions asked.
- Also note that unless otherwise stated, the C++ keywords “using namespace” and “friend” are forbidden. Their use will be punished by a -42, no questions asked.
- Since you are allowed to use the C++ tools you learned about since the beginning, you are not allowed to use any external library. And before you ask, that also means Namespace, class, member functions, stdio stream, initialization lists, static, const, and no C++11 and derivates, nor Boost or anything your awesomely skilled friend told you C++ can’t exist without.
- You may be required to turn in an important number of classes. This can seem tedious, unless you’re able to script your favorite text editor.
- The compiler to use is clang++.
- Your code has to be compiled with the following flags : -Wall -Wextra -Werror.
C++ 과제의 첫 번째를 수행하기에 앞서서, 공통 수칙을 읽어보면, 핵심 문장과 키워드를 발견할 수 있다.
- C스타일 함수 사용은 금지됨. (*alloc, *printf, free)
- CPP Module 08 까지는 STL을 사용해서는 안됨.
- using namespace, friend 키워드는 금지.
- C++의 반드시 필요한 요소만 사용해서 코딩해야함. C++11 및 어떠한 외부 라이브러리도 허용치 않음.
- 컴파일러는 clang++
- 컴파일 플래그는 -Wall -Wextra -Werror
컴파일러와 컴파일 플래그를 알아냈으니, C 과제들에서 익혀둔 Makefile 템플릿을 먼저 만들어두기로 했다.
CC = clang++
CFLAGS = -Wall -Wextra -Werror -std=c++98
SRCS =
INC =
FINAL_SRCS = $(addsuffix .cpp, $(SRCS))
FINAL_OBJS = $(FINAL_SRCS:.cpp=.o)
NAME =
all: $(NAME)
%.o: %.cpp
$(CC) $(CFLAGS) $(INC) -c $< -o $@
$(NAME): $(FINAL_OBJS)
$(CC) $(CFLAGS) -o $@ $^
clean:
rm -f $(FINAL_OBJS)
fclean: clean
rm -f $(NAME)
re: clean all
.PHONY: all clean fclean re
추후 헤더 및 소스 파일을 편하게 추가할 수 있게 SRCS, INC 변수를 남겨두었고, NAME 변수 또한 남겨두었다.
나머지는 C과제에서 했던 부분과 Makefile의 Norm과 똑같이 맞추었다.
이제 이것을 기반으로 CPP Module 끝 까지 완성해 나가자..!
'Development > 42 Seoul' 카테고리의 다른 글
[ft_containers] vector (0) | 2021.12.17 |
---|---|
42 CPP Module 08 ex00에서, 반복문을 단 하나도 안쓰기 (직접 만든 함수로 STL bind1st, bind2nd 사용) (0) | 2021.12.11 |
[Minishell] 미니쉘 테스트 할만한거 (0) | 2021.12.11 |
C++ 글자 출력, 프로그램 인자, 대문자로 변환. (0) | 2021.12.11 |
CPP Module 04 문제 메모 (0) | 2021.12.11 |