Can I write C++ code without headers (repetitive function declarations)?(我可以编写没有标头的 C++ 代码(重复函数声明)吗?)
问题描述
有没有什么方法可以不必编写两次函数声明(头文件),并且在使用 C++ 编程时仍然保持相同的编译可伸缩性、调试的清晰度和设计的灵活性?
Is there any way to not have to write function declarations twice (headers) and still retain the same scalability in compiling, clarity in debugging, and flexibility in design when programming in C++?
推荐答案
使用Lzz.它需要一个文件并自动为您创建一个 .h 和 .cpp,所有声明/定义都在正确的位置.
Use Lzz. It takes a single file and automatically creates a .h and .cpp for you with all the declarations/definitions in the right place.
Lzz 确实非常强大,可以处理 99% 的完整 C++ 语法,包括模板、特化等.
Lzz is really very powerful, and handles 99% of full C++ syntax, including templates, specializations etc etc etc.
更新 150120:
较新的 C++ '11/14 语法只能在 Lzz 函数体中使用.
Newer C++ '11/14 syntax can only be used within Lzz function bodies.
这篇关于我可以编写没有标头的 C++ 代码(重复函数声明)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我可以编写没有标头的 C++ 代码(重复函数声明)吗?


基础教程推荐
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- CString 到 char* 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01