Skip to content

metwse/cpp-chat-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpp-chat-server

A simple TCP-based chat server implemented in C++.

Contributing

Contributions are welcome! Please follow conventional C/C++ style and document any new functionality with clear comments or test files. This project mostly applies Canoncial Project Structure with minor exceptions.

Please also check our Code of Conduct before contributing.

Building

Release Build

make build

This compiles the project with optimization flags into target/chatd.

Debug Build

make build_debug

This compiles with debug symbols (-g3) and assertions enabled into target/chatd.debug.

Running

Command Description
make run Runs the optimized binary.
make debug Runs the debug binary inside gdb.
make memcheck Runs the project with valgrind.

Tests

Unit tests are automatically discovered if files end with .test.c or .test.cpp.. For C++ tests, append .xx to the Make target name.

For example, if you have a file like chatd/collections/vec.test.c, you can:

  • Build it with: make build_test_colections/vec
  • Run it under gdb with: make test_collections/vec
  • Run it under valgrind with: make memcheck_test_collections/vec

For C++, Make targets are the same but postfixed with .xx. I.e. to run chatd/collections/vec.test.cpp, use make test_collections/vec.xx.

Note: Test binaries are placed under target/tests.

Dependencies

  • GNU Make (v4 or later)
  • g++, gcc
  • bear (optional, for compile_commands)
  • valgrind (optional, for memleak)
  • gdb (optional, for debugging)

Generating Compilation Database

To generate a compile_commands.json file for use in IDEs or language servers:

make compile_commands

About

Text-based chat server written in C/C++

Topics

Resources

License

Stars

Watchers

Forks