在linux中编写C ++?!!!!!!!!!!! [英] Coding C++ in linux?!!!!!!!!!!!

查看:80
本文介绍了在linux中编写C ++?!!!!!!!!!!!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好每个人:

i已经用c ++编程了一年多,所有这些都是在visual studio 2010上,

所以我从2年开始使用linux从来没有尝试过编程,在这里我们去,我试着在上面编写c ++,但我不知道怎么做,所以

1)如何在其上包含库

2)如何在boost上添加库并包含它们?

3)如何配置和安装.cpp文件,以及如何使用linux执行.exe文件?<顺便提一下
不要告诉我关于像eclipse和geany这样的IDE,我想学习本土的方式

我现在也在使用opensuse 12.3

请帮助

谢谢。

hello every body :
i have been programming in c++ more than a year ,all of them were on visual studio 2010,
so i started using linux from 2 years bt never tried to program on it and here we go, i tried to program c++ on it , but i didnt know how to do it , so
1) how to include libraries on it
2) how to add libraries on it like boost and include them ?
3)how to configure and make install for .cpp files, and how to do .exe files using linux?
by the way Dont tell me about IDEs like eclipse and geany , i want to learn the native way
also i am using now opensuse 12.3
please help
thank you .

推荐答案

(我不是linux专家)



应该有一个软件包,在你的linux系统上安装BOOST库;或者从boost.org下载这些东西并配置它来构建和设置库。 (阅读README文件以获取完整说明)。



如果您不想使用IDE,则需要学习使用并创建制作文件 [ ^ ];对于简单的项目来说很容易,对于复杂的项目来说,它可能会更加困难。



还要学习不同的GCC和G +++编译器和链接器开关来添加包含路径和库路径。
(I''m no linux expert)

There should be a "package" of some sort to install the BOOST libraries on your linux system; or download the stuff from boost.org and "configure" it to build and setup the libraries. (read the README files for complete instructions).

If you do not want to use and IDE you will need to learn to use and create a makefile[^]; for simple projects it is easy, for complex projects it can be more difficult.

Also learn the different GCC and G+++ compiler and linker switches to add include path and library path.

如果您的大部分经验都基于Microsoft和Visual Studio,那么非常接近Visual Studio的IDE可以为您提供很多帮助:

http://en.wikipedia.org/wiki/Anjuta [ ^ ],

http:/ /www.anjuta.org/ [ ^ ]。







为了增强库,我强烈建议您下载其源代码并使用您的解决方案构建。请参阅:

http://www.boost.org/users/download/ [ ^ ]。



在上面引用的页面上,你可以看到Subversion(SVN)命令。



这是Subversion存储库:

http://svn.boost.org/svn/boost/trunk [ ^ ]。



Subversion包含在大多数Linux发行版的代码库中,但默认情况下不预装。请参阅:

http://en.wikipedia.org/wiki/Subversion_%28software %29 [ ^ ],

http://subversion.apache.org/ [ ^ ]。



-SA
If most of your experience is based on Microsoft and Visual Studio, this IDE very close to Visual Studio can help you a lot:
http://en.wikipedia.org/wiki/Anjuta[^],
http://www.anjuta.org/[^].



As to boost libraries, I would strongly recommend to download its source and build with your solution. Please see:
http://www.boost.org/users/download/[^].

On the page referenced above, you can see the Subversion (SVN) command.

This is the Subversion repository:
http://svn.boost.org/svn/boost/trunk[^].

Subversion is included in code repository for most Linux distro, but not preinstalled by default. Please see:
http://en.wikipedia.org/wiki/Subversion_%28software%29[^],
http://subversion.apache.org/[^].

—SA


如果你想在Linux上采用与GNU方式近似的本机方式。

要做你提到的事情,首先需要了解 make

Make是构建并可能安装软件的工具(Linux软件)通常在GNU思维模式中作为要构建的源进行分发。



make工具处理所谓的make文件的层次结构,它们本质上是声明性脚本在源的目录树的每个文件夹中,描述如何从另一个构建一个东西。构成.a静态库的.cpp文件,构成可执行文件的静态库(无可执行文件的扩展名)或文件移动以及构成安装的其他命令。 br $>


Make文件(默认名称Makefile)是用Make语言编写的,没有正式的名称,语法,语法,或者我可以告诉任何''正确的''文档,所以从 man make 开始,直接转到基于Web的教程。



使自己成为群组的一部分被称为''autotools''包的工具, zypper install autotools 可能会告诉你这些已经存在。 Autotools包括脚本和二进制文件,如 automake autoconf ,这使得生成,维护和执行make变得更容易或更复杂,具体取决于你对他们的了解程度如何它们帮助您生成的输出的关键组件是 configure 脚本,它是一种无休止的难以言喻的Bash脚本语言中的Bash脚本。配置脚本是构建和安装过程的可移植引导部分,它使用其他脚本来分析主机系统,其功能和脑损伤,因为某些GNU开发人员喜欢以不同方式调用事物。 Configure还可以在完整的Autotools场景中生成或部分生成Makefile,甚至可以用来重写源代码块,使用任何标准Unix工具grep,在主机系统的配置中定位它们。 sed等

最终结果是您使用autotools生成的脚本和您的辛勤工作来发送源代码。然后用户执行类似以下操作。



./configure

make(或make check)

make install



请记住,绝对不要指示用户在安装任何文件的位置或当前文件夹输入上述或任何其他命令时应该是什么。这可以防止所有不知情的人建立或安装您的软件,一次性消除Noobs和Plebs的所有问题。

如果你没有做到这一点并向软件提供任何白痴实际可以使用的完整说明,那么你将被永远地避开,你的民粹主义和不合时宜的输出将被禁止进入所有主要的存储库。这是GNU法律。我已经从Linux世界中被引渡,甚至将其写下来,所以我不再关心告诉你的后果。



(有些人认为我对Linux有点愤世嫉俗。我无法发表评论)
If you want to do things the ''native'' way on Linux that approximates to the GNU way.
To do the things you mentioned you first need to understand make.
Make is the tool that builds and potentially installs the software ( Linux software is usually distributed as source to be built, in the GNU mindset )

The make tool processes a hierarchy of so called ''make files'' which are essentially declarative scripts in each folder of the directory tree of your source, describing how to construct one thing from another. The .cpp files that go to make up a .a static library, the .a static libraries that go to make up an executable (no extension for executables) or the file moves and and other commands that go to make up an installation.

Make files (default name Makefile) are written in Make language which has no official name, syntax, grammar or as far as I can tell any ''proper'' documentation, so start with man make and move directly to web based tutorials.

Make itself forms part of a group of tools known as the ''autotools'' package, zypper install autotools will probably tell you these are already present. Autotools includes scripts and binaries like automake and autoconf which make generating, maintaining and executing make either easier or more complex depending on how well you understand them. The key component of the output they help you produce is the configure script which is a Bash script in the endlessly unspeakable Bash scripting language. The configure script is the ''portable'' bootstrap part of the build and install process which uses other scripts to analyse the host system, its capabilities and "brain damage" as certain GNU developers like to call things done differently. Configure also generates or partially generates the Makefiles in a full Autotools scenario and can even be used to rewrite chunks of the source code to target them at the host system''s configuration using any of the ''standard'' Unix tools, grep, sed etc.
The end result is you ship your source with the scripts generated by autotools and your hard work. The user then does something similar to the following.

./configure
make ( or make check )
make install

Remember it is compulsory never to instruct the user where any file should be installed or what the current folder should be when they type the above or any other commands. This prevents all the uninitiated from ever building or installing your software removing all the problems with Noobs and Plebs in one go.
If you fail to do this and provide software with full instructions that any idiot can actually use you will be shunned forever and your populist and unseemly output will be barred from all major repositories. This is the GNU law. I''ve already been extradited from the Linux world for even writing it down so I no longer care about the consequences of telling you.

( Some people think I am slightly cynical about Linux. I couldn''t possibly comment )


这篇关于在linux中编写C ++?!!!!!!!!!!!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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