3

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. 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 ?

  4. Links to beginner level tutorials will be helpful.

  5. 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...

dotnetcoder
  • 3,431
  • 9
  • 54
  • 80
  • I appologize for being years late, but for fairly in-depth network stats in C++, you should check out QPcap. QPcap Provides a QT style C++ API for libpcap, and fits right in with a QT application. – J. M. Becker Jul 14 '13 at 19:29

3 Answers3

7

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

Community
  • 1
  • 1
4

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.

mhmhmhmh
  • 434
  • 1
  • 5
  • 13
  • 2
    You should definitely learn emacs before you do anything else related to programming in Linux. Trust me, its a very worthwhile investment. – Chetan Dec 29 '09 at 21:00
  • @nagnatron - "default desktop environment in Mint is GNOME" - "Qt is based on KDE" - does it conflict with defalut env being GNOME ? – dotnetcoder Dec 29 '09 at 21:04
  • 1
    @dotnetcoder: Qt is not based on KDE, but the other way around. KDE is made with Qt. They don't conflict. Qt apps in GNOME just look a bit different from native GTK apps. – mhmhmhmh Dec 29 '09 at 21:37
  • @miloshadzic: This is no longer the case, though. – Sebastian Mach Apr 05 '12 at 07:34
  • @phresnel I don't actually program in C++ much any more so tell you what: You suggest what I should edit and I'll update my answer and credit you. – mhmhmhmh Apr 05 '12 at 11:22
1

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.

Phil Miller
  • 36,389
  • 13
  • 67
  • 90