1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

c++の基本を備忘録的にまとめていく Part2 (Makefile)

Last updated at Posted at 2019-02-15

最近無性にc++を触りたい

やったこと

makefileを頑張って書いた。
↓↓↓今回書いたMakefile↓↓↓

makefile
 COMPILER  = g++
 CPP_FLAGS = -g -Wall
 OBJ_DIR   = ./objs/
 SOURCES   = $(wildcard ./src/*.cpp)
 OBJECTS   = $(SOURCES: .cpp=.o)
 INCLUDE   = -I ./include
 TARGET    = {target_name}

 #PHONY: clean run
 
 $(OBJ_DIR)%.o: $(SOURCES)
     $(COMPILER) $(CPP_FLAGS) $(INCLUDE) -o $@ -c $^
 
 $(TARGET): $(OBJECTS)
     $(COMPILER) $(CPP_FLAGS) $(OBJECTS) -o $(TARGET)
 
 clean:
   rm -f $(TARGET)

Directory構造としては以下のような感じ

├── README.md
├── include
│   ├── module.hpp
│   └── test.hpp
├── src
│   ├── main.cpp
│   └── test.cpp
│
├── makefile
└── test

コンパイルする時、srcに入っている*.cppを読み込み、.hppを参照している

単純に書いただけなのでもっとsrc以下も階層化したものに対応していきたい

あと当面の目標としては、c++使って眼球運動を追いかけたいと思いました。

gitにあげました
https://github.com/shKomic/cpp_template

こんなコードあるよとか返信されると、とても喜びます

Part3(libcurl) => https://qiita.com/komi9977/items/71350e863e759a83f81d

1
0
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?