Linux 上的 C++ 开发 - 我从哪里开始?

我决定放弃我的 Windows 安装,现在将 Debian 作为我的默认操作系统运行。我一直在 Windows 中进行编码,特别是使用 Visual Studio。我目前正在尝试习惯在 linux 下编译我的代码。

虽然我还有很多文档要阅读,而且不要指望你们让我觉得它太容易了,但如果能得到一些关于从哪里开始的指示仍然会很好。我有一些具体问题,但请随时提出/推荐有关该主题的任何其他内容。

  • 关于创建 make 文件有哪些推荐指南,如何从这个 makefile 编译(我自己调用 g++,是否使用“make”?)
  • 查看其他 linux 软件,它们几乎总是有一个“配置”文件。它究竟是做什么的?它是只检查是否安装了所需的库,还是不仅仅是检查要求?
  • 如何链接库,这与我的 makefile 或 g++ 参数有何关系?在 Windows 中,我会编译库,包含一些头文件,告诉我的链接器要链接哪些额外的 lib 文件,然后复制一个 dll 文件。这个过程在 linux 中究竟是如何工作的?
  • 对代码编辑器的建议?我目前正在使用 nano,我听说过 vim 和 emacs,但不知道它们对彼此有什么好处。还有其他的吗,为什么我会在前三个中考虑它们?注意:我不是在寻找 IDE。

非常感谢任何帮助、指南和文档链接(最好是针对初学者的)!

最佳答案

What are recommended guides on creating a make file, how do I compile from this makefile (do I call g++ myself, do I use 'make'?)

您通过调用“make”从 makefile 构建。在您的 makefile 中,您使用 g++ 和 ld 进行编译和链接。

Looking at other linux software, they almost always seem to have a 'configure' file. What exactly does it do? Does it only check if the required libraries are installed or does it more than just checking requirements?

这是一个脚本,通常用于根据用于构建的环境设置各种事物。有时它只是一个基本的 shell 脚本,有时它会调用 Autoconf 等工具来发现构建时可用的内容。 “配置”脚本通常也是用户指定要构建或排除的各种可选内容的地方,例如对实验性功能的支持。

How do I link libraries, and how does this relate to my makefile or g++ parameters? In windows I would compile the library, include some header files, tell my linker what additional lib file to link, and copy a dll file. How exactly does this process work in linux?

ld 是 GNU 链接器。您可以单独调用它(这是大多数 makefile 最终会执行的操作),或者您可以让 g++ 委托(delegate)给它。传递给 g++ 和 ld 的选项决定了在哪里查找包含的头文件、要链接的库以及如何输出结果。

Recommendations for code editors? I am currently using nano and I've heard of vim and emacs, but don't know what the benefits of them are over eachother. Are there any others, and why would I consider them over any of the previous three? Note: I am not looking for an IDE.

Vim 和 Emacs 是非常灵活的编辑器,它们支持一大堆不同的用法。使用你觉得最好的任何东西,但我建议你可能需要一些最小的东西,比如语法突出显示。

https://stackoverflow.com/questions/623040/

相关文章:

c - 你如何在 C 中的 Linux 上进行非阻塞控制台 I/O?

linux - 如何在 Bash 字符串中添加新行?

linux - find 和 ls 上的通配符

c++ - 将字符串作为指针或文字传递时,strcmp() 返回值不一致

c - 使用 gdb 将地址转换为行

c - 无论如何要从命令行获取c程序的返回值?

linux - 如何将上下文后的 grep 设置为 "until the next blank li

c - 如何在 Linux 中创建高分辨率计时器来测量程序性能?

linux - 将 Emacs 复制/粘贴与系统复制/粘贴集成

c - 分段故障处理