1 Star 0 Fork 0

TangQuanwei / code-cpp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
WTFPL

CODE_CPP

Fork me on Gitee

This is all my learning of cpp

这是我的代码规范 C/C++

#define BUF_SIZE 1024       // 宏定义全部大写,下划线分隔
constexpr ARRAY_LEN 265     // 常量全部大写,用下划线分隔

/*
变量命名要有意义
变量名尽量不缩写
作用域越大, 名字可以越长
*/
                            // 注释对齐
char* my_name = nullptr;    // 变量全部小写用下划线分隔
int g_flag;                 // 全局变量 g_xxx

class FileManage            // 类名大驼峰
{                           // 函数名一般用动宾,变量名一般用名词
privite:
    string m_name;          // 成员变量 m_xxx

public:
    bool isFind;            // 布尔变量应写成谓词
    static string s_name;   // 静态变量 s_xxx
    string getName();       // 小驼峰
    bool isExsit();
}

生成和调用动态 dll 库

  1. windows 生成动态 dll 库的编译命令如下:
 g++ --share ai.cpp -o ai.dll
 #或者
 g++ -shared ai.cpp -o ai.dll
  1. Linux 下生成相对应的文件,后缀一般为 so。编译指令与 windows 下类似,只是必须指定参数-fPIC,即“地址无关代码 Position Independent Code”。
g++ --share ai.cpp -fPIC -o ai.so
#或者
g++ -shared ai.cpp -fPIC -o ai.so
  1. 调用生成的动态 dll 库 执行下面的代码,演示如何调用生成的动态 dll 库
 g++ ai.dll demo.cpp -o demo.exe

目录结构:

Folder PATH listing
Volume serial number is B45F-1DFD
D:.
├───.vscode
├───lang
│   ├───basic
│   ├───brain_fuck
│   ├───file_exception
│   ├───functional
│   ├───math
│   ├───my_class
│   │   ├───Mystring
│   │   ├───String
│   │   └───vector
│   ├───recursive
│   ├───skill
│   └───stl_templet
├───mds
├───spy_control_system
├───Test
├───txt
├───_01_Algorithms
│   ├───backtracking
│   ├───bit_manipulation
│   ├───ciphers
│   ├───data_structures
│   │   └───cll
│   ├───dynamic_programming
│   ├───geometry
│   ├───graph
│   ├───graphics
│   ├───greedy_algorithms
│   ├───hashing
│   ├───linear_algebra
│   ├───machine_learning
│   ├───math
│   ├───numerical_methods
│   ├───operations_on_datastructures
│   ├───others
│   ├───probability
│   ├───range_queries
│   ├───search
│   ├───sorting
│   └───strings
└───_02_Date_Structure
    ├───1-LinearList
    │   ├───list
    │   │   ├───array_list
    │   │   └───linked_list
    │   ├───matrix
    │   ├───queue
    │   └───stack
    ├───2-String
    ├───3-Tree
    ├───4-Graph
    └───7-Design
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO.

简介

在下毕生所学习的CPP 展开 收起
C++ 等 2 种语言
WTFPL
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C++
1
https://gitee.com/quanw20/code-cpp.git
git@gitee.com:quanw20/code-cpp.git
quanw20
code-cpp
code-cpp
master

搜索帮助