当前位置:网站首页>VS2017 compile Tars test project

VS2017 compile Tars test project

2022-07-30 22:07:00 Hello, C++!

1. Download and compile TarsCpp in Windows environment

git clone https://github.com/TarsCloud/TarsCpp.git --recursivecd TarsCpp;mkdir build;cd build;cmake .. -G "Visual Studio 15 2017"cmake --build . --config release#installcmake --build . --config release --target install12345678

Note: If you need to install the debug library, change the command to the following:

cd TarsCpp;mkdir build;cd build;cmake .. -G "Visual Studio 15 2017"cmake --build . --config debug#installcmake --build . --config debug --target install1234567

Under normal circumstances, the compilation can be normal.If there are various problems with the installation, you can try reinstalling the system and VS2017...

After the compilation and installation is completed, the Tars library and header files will be generated under the C drive by default.
insert image description here

2. Develop TarsCpp test project

New VS2017 project
Insert image description here
Put TarsCpp example insideCopy the AuthClient and AuthServer source files to the corresponding test project, then use tars2cpp.exe to generate Hello.h, and then add the files to the project.Then add the include and lib in the C:\tars\cpp directory to the project configuration respectively.

3. Modify the configuration file

Modify the config.conf files of AuthServer and AuthClient and change the IP.
insert image description here

4 Run Test Project

Run AuthServer
insert image description here
Run AuthClient
insert image description here

原网站

版权声明
本文为[Hello, C++!]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/211/202207302155312062.html