I made a Non-Qt project, Plain C++ Application in QT creator. My current folder structure is like this:
.
├── client
│ ├── client.cpp
│ └── client.h
├── CMakeLists.txt
├── CMakeLists.txt.user
├── main.cpp
└── server
├── server.cpp
└── server.h
My CMakeLists.txt file looks like this:
cmake_minimum_required(VERSION 3.5)
project(eshraagh-project LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(eshraagh-project main.cpp server/server.h server/server.cpp client/client.h client/client.cpp)
In my main file, I included server.h and client.h and made instances of both of them, and it didn't give any errors.
The problem arises when I try to use an external library (this library). I have no idea how to use it.
I tried to copy contents of its src folder (cpnet-export.h, cpnet-network.h and cpnet-network.c) into my project and add them to CMakeLists, just like I did with server and client files, but it doesn't work. I copied the server part of the repository and pasted it in my main, but it gives me errors such as undefined reference to 'cpnet_bind'
and more (A little note: The repository uses the functions with net prefix, but QT recommender told me to write cpnet prefix instead. I don't know why this is happening).