Linux 上的 C++ 开发 - 我从哪里开始? [英] C++ development on linux - where do I start?

查看:28
本文介绍了Linux 上的 C++ 开发 - 我从哪里开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I decided to leave my windows install behind and am now running Debian as my default OS. I have always coded in Windows and specifically with Visual Studio. I am currently trying to get used to compiling my code under linux.

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

Although I still have a lot of documentation to read, and don't expect you guys to make it too easy for me, it'd still be nice to get some pointers on where to start. I have some specific questions, but feel free to suggest/recommend anything else regarding the subject.

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

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

Any help, links to guides & documentation (preferably those that are aimed at beginners) are very much appreciated!

推荐答案

关于创建 make 文件的推荐指南有哪些,如何从这个 makefile 编译(我自己调用 g++,是否使用make"?)

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 进行编译和链接.

You build from the makefile by invoking "make". And inside your makefile, you compile and link using g++ and ld.

查看其他 linux 软件,它们几乎总是有一个配置"文件.它究竟是做什么的?它是只检查是否安装了所需的库,还是不仅仅是检查要求?

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 等工具来发现构建时可用的内容.配置"脚本通常也是用户指定要构建或排除的各种可选内容的地方,例如对实验性功能的支持.

It's a script usually used to set up various things based on the environment being used for building. Sometimes it's just a basic shell script, other times it invokes tools like Autoconf to discover what is available when building. The "configure" script is usually also a place for the user to specify various optional things to be built or excluded, like support for experimental features.

如何链接库,这与我的 makefile 或 g++ 参数有何关系?在 Windows 中,我会编译库,包含一些头文件,告诉我的链接器要链接哪些额外的 lib 文件,然后复制一个 dll 文件.这个过程在 linux 中究竟是如何工作的?

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++ 委托给它.传递给 g++ 和 ld 的选项决定了在哪里查找包含的头文件、要链接的库以及如何输出结果.

ld is the GNU linker. You can invoke it separately (which is what most makefiles will end up doing), or you can have g++ delegate to it. The options you pass to g++ and ld determine where to look for included headers, libraries to link, and how to output the result.

对代码编辑器的建议?我目前正在使用 nano,我听说过 vim 和 emacs,但不知道它们对彼此有什么好处.还有其他的吗,为什么我会在前三个中考虑它们?注意:我不是在寻找 IDE.

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 是非常灵活的编辑器,它们支持一大堆不同的用法.使用你觉得最好的任何东西,但我建议你可能需要一些最小的东西,比如语法突出显示.

Vim and Emacs are very flexible editors that support a whole bunch of different usages. Use whatever feels best to you, though I'd suggest you might want a few minimal things like syntax highlighting.

这篇关于Linux 上的 C++ 开发 - 我从哪里开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆