开发者

learning c++ on linux mint ( for .net developer )

My goal is to hop on to C++ programming language by doing a homework project on linux mint and learn some linux & c++ at the same time.

I intend to write a small desktop application to show current network traffic ( like DU meter in windows). I have following questions:

  1. I noticed in mint there is an application called 'System Monitor' which also shows network history with info and graph like current download/upload of data and speed. Is it a good idea to get started by looking at the code for this ? how can I find the code for same in mint and dig into it ? pls help with some steps here if possible.

  2. what tools do I need here for writing c++ application for/in linux mint ?

  3. 开发者_StackOverflow社区
  4. Which GUI library to use ( like in c# winforms , it offers user controls as part of GDI lib) on linux mint what do we have that offers user controls like window/button/panel/etc ?

  5. Links to beginner level tutorials will be helpful.

  6. Hoping NOT to re-invent the wheel completely here. Would love to re-use some lib that do the network traffic part, ideas ?

PS: i know this post reads 'wanna be' - I am really excited to kickstart with some c++. Will rephrase this post with more precise questions.Hunting in the dark at this point being a c# developer totally spoiled by windows.

Thanks in Advance!!! for tips on this...


The mint distribution is based on Ubuntu/Debian, so I assume that my Ubuntu approach also works on mint.

First

you need some tools, libraries and headers:

# install the standard toolchain (g++, make, etc.)
sudo aptitude install build-essential

# install the build dependencies for a desktop based networking tool
sudo aptitude  build-dep gnome-nettool

Optionally

because you mentioned the system-monitor - it might be helpful to build the gnome-system-monitor from source:

# install the build dependencies for gnome-system-monitor
sudo aptitude  build-dep gnome-system-monitor

# get the sources for the gnome-system-monitor
mkdir example
cd example
apt-get source gnome-system-monitor

# build the gnome-system-monitor
# note: you might have a different version. But I'm sure you get the idea ;-)
cd  gnome-system-monitor-2.28.0
sh configure
make

Finally

you need something to develop and debug. A lot of unix developers recommend emacs or vi(m). But my personal opinion is that you should start with a "modern" GUI based IDE.

here's a collection of some commonly used IDEs:

  • Eclipse with CDT
  • NetBeans
  • Code::Blocks
  • Anjuta (was this used to develop the gnome-system-monitor ?)
  • CodeLite (which is my personal favorite)

see also: discussion on SOF regarding "the best" C++ IDE for Linux


People usually use text editors like (g)Vim or emacs to write C++ applications. If you've never seen them before they may be a bit overwhelming. You can also use IDEs like Geany, Anjuta, QtCreator, Eclipse...

I think the default desktop environment in Mint is GNOME which uses the GTK library. You could use GTK for your application. It is written in C but there is a c++ interface for it, gtkmm, and a tutorial for it on the projects site.

There is also Qt, which is the base of the K Desktop Environment or KDE. It is a very large library and has a pretty good IDE written in it, for it, QtCreator.

Finally, you should search stackoverflow because most of your questions have already been answered.


In answer to you "what tools do I need", you should at a minimum install g++, the standard C++ compiler on a GNU/Linux system.

Linux Mint is based on Ubuntu (which is in turn based on Debian), so for a binary like gnome-system-monitor, the command

apt-get source $(dpkg -S $(which gnome-system-monitor) | cut -d: -f1)

will download and unpack the source package for it in the current directory. Note that it probably depends on a number of libraries, that can be found in different packages. You can see what these are with apt-cache show package_name, and libraries often have associated development packages named with -dev that contain the associated headers and statically-linked archives. You can find the dev package names by searching using apt-cache search foo, where foo is the base name of the library package you're interested in.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜