Add CPP
This commit is contained in:
parent
e5c8c71c0f
commit
bb10a715c3
7 changed files with 59 additions and 0 deletions
2
cpp/.gitignore
vendored
Normal file
2
cpp/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.o
|
||||
example
|
3
cpp/.vscode/extensions.json
vendored
Normal file
3
cpp/.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"recommendations": ["llvm-vs-code-extensions.vscode-clangd"]
|
||||
}
|
8
cpp/.vscode/settings.json
vendored
Normal file
8
cpp/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"editor.tabSize": 2,
|
||||
"editor.insertSpaces": false,
|
||||
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true
|
||||
}
|
26
cpp/Makefile
Normal file
26
cpp/Makefile
Normal file
|
@ -0,0 +1,26 @@
|
|||
CXX = g++
|
||||
CXXFLAGS = --std=c++11
|
||||
RM = rm
|
||||
|
||||
SOURCES = $(wildcard src/*.cpp)
|
||||
OBJETS = $(patsubst %.cpp,%.cpp.o,$(notdir $(SOURCES)))
|
||||
|
||||
EXE = example
|
||||
|
||||
%.cpp.o: src/%.cpp
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS) $(DEVFLAGS)
|
||||
|
||||
main: CXXFLAGS += -O3
|
||||
main: compilation
|
||||
|
||||
dev: CXXFLAGS += -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g -Wold-style-cast -Wsign-conversion
|
||||
dev: compilation
|
||||
|
||||
compilation: $(OBJETS)
|
||||
$(CXX) -o $(EXE) $(OBJETS)
|
||||
|
||||
all:
|
||||
main
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJETS) $(EXE)
|
10
cpp/includes/Example.hpp
Normal file
10
cpp/includes/Example.hpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef PROJECT_EXAMPLE_HPP
|
||||
#define PROJECT_EXAMPLE_HPP 1
|
||||
|
||||
#include <iostream>
|
||||
|
||||
struct Example {
|
||||
Example();
|
||||
};
|
||||
|
||||
#endif
|
3
cpp/src/Example.cpp
Normal file
3
cpp/src/Example.cpp
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include "../includes/Example.hpp"
|
||||
|
||||
Example::Example() { std::cout << "Hello, world!\n"; }
|
7
cpp/src/main.cpp
Normal file
7
cpp/src/main.cpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include "../includes/Example.hpp"
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
Example();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue