Skip to content

Commit

Permalink
feat: add simplest possible c++ setup
Browse files Browse the repository at this point in the history
  • Loading branch information
matihost committed Dec 1, 2024
1 parent 264d816 commit 8bd98d1
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,37 @@ dist

# Ignore generated credentials from google-github-actions/auth
gha-creds-*.json

# C++
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
18 changes: 18 additions & 0 deletions c++/learning/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CXX = g++
CXXFLAGS = -g -Wall
TARGET = main.out
SRC = $(wildcard *.cpp)
OBJ = $(SRC:.cpp=.o)

all: $(TARGET)

# Build target
$(TARGET): $(OBJ)
$(CXX) $(CXXFLAGS) $(OBJ) -o $(TARGET)

%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@

# Clean target
clean:
rm -f $(TARGET) $(OBJ)
22 changes: 22 additions & 0 deletions c++/learning/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# C++

Various sample C++ applications showing C++ lang structure, concepts, sample libraries usage build, dependency management etc.

## Prerequisites

C++ compiler

```bash
# for Ubuntu
sudo apt -y install build-essential
```

## Building from code

```bash
# to build application
make

# to remove intermediate build files and compiled application
make clean
```
7 changes: 7 additions & 0 deletions c++/learning/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <iostream>
using namespace std;

int main() {
cout << "Hello, World!" << endl;
return 0;
}

0 comments on commit 8bd98d1

Please sign in to comment.