Getting back into C++ with knoppix

  • Context: C/C++ 
  • Thread starter Thread starter julian
  • Start date Start date
  • Tags Tags
    C++
Click For Summary

Discussion Overview

The discussion revolves around getting started with C++ programming using the KDevelop IDE on an older version of Knoppix. Participants share their experiences and provide guidance on using the IDE, compiling code, and navigating the UNIX environment.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant expresses uncertainty about using KDevelop and asks for guidance on creating a new file.
  • Another participant confirms that KDevelop is the correct tool to use and suggests updating the distribution for the latest features.
  • There is a discussion about whether to use an IDE or a text editor, with some suggesting that a simpler text editor may be more suitable for beginners.
  • One participant mentions difficulties compiling a program, receiving error messages related to file recognition.
  • Another participant explains the importance of using the correct file suffix for C++ files and suggests using g++ for compilation instead of gcc.
  • Some participants recommend checking online resources for tutorials and documentation related to KDevelop and C++ programming.

Areas of Agreement / Disagreement

Participants do not reach a consensus on whether to use an IDE or a text editor, with differing opinions on the best approach for someone returning to C++. The discussion includes both supportive and critical views on the use of IDEs.

Contextual Notes

There are mentions of specific commands and file naming conventions that may depend on the user's familiarity with UNIX and programming in C/C++. Some participants note the need for proper directory structure when compiling programs.

Who May Find This Useful

This discussion may be useful for individuals returning to C++ programming after a long break, those unfamiliar with KDevelop, or anyone seeking guidance on compiling C++ code in a UNIX environment.

julian
Science Advisor
Gold Member
Messages
861
Reaction score
366
Been a long time since I did any C/C++. I have an older version of knoppix which looks like it might have C++.

I'll need some step by step help here - don't know very much. I go to the menu, go to "Development", and there is a "KDevelop: C/C++ (IDE for C/C++)". Should I click on this or something else?
 
Technology news on Phys.org
KDevelop is the graphical IDE for the GNU Compiler Collection - so that's what you want, yep.
http://kdevelop.org/

The c/c++ compiler is called gcc and can be called from the commandline.
You should probably update your distro though ... it will have the latest compiler and IDEs.
Some parts of the older gcc versions are no longer supported in the newer ones.

The knoppix forums have specific help on using the distro and it's bits.
 
So I've clicked on it. Should I now click on "File", "new"? It asks for a file name - do I have to write like name.something ? Sorry I really know nothing.
 
In UNIX everything is files. The IDE will let you open an existing file or you can start a new project which will have it's own file and thus a filename. So yeah - you have to type one in - name your program. Have you used any Unix-type software before?

I've never used an IDE in my life, and it sounds like you havn't either.
You may be happier with a text editor and a terminal ... how did you program before?

There will be user documentation someplace - in a terminal, type "man kdevelop" or "info kdevelop" for clues ... or use the kdevelop link above.
 
julian said:
So I've clicked on it. Should I now click on "File", "new"? It asks for a file name - do I have to write like name.something ? Sorry I really know nothing.

I suggest to have a look at http://www.learncpp.com/.
 
  • Like
Likes   Reactions: 1 person
Simon Bridge said:
In UNIX everything is files. The IDE will let you open an existing file or you can start a new project which will have it's own file and thus a filename. So yeah - you have to type one in - name your program. Have you used any Unix-type software before?

I've never used an IDE in my life, and it sounds like you havn't either.
You may be happier with a text editor and a terminal ... how did you program before?

There will be user documentation someplace - in a terminal, type "man kdevelop" or "info kdevelop" for clues ... or use the kdevelop link above.

I've used UNIX to do latex but that's all.

I got up a kDevelop window, I named a file called "pop". Typed in a sample programme.

I clicked on "Konsole" and a narrow window came up at the bottom. I tried typing in "g++ pop" and "gcc pop" and "c++ pop" to try to compile the programme but every times got the message
"pop: file not recognized: File format not recognized
collect2: ld returned 1 exit status"
 
You may be happier with a text editor and a terminal ... how did you program before?
Have you tried the knoppix help site?
Have you tried the learn cpp site?
 
I don't think someone who's new to c/c++ is going to use a text editor like vi or emacs better to start with pico, make sure your using the right directory structure when compling your programs, you'll usually be put in etc/home so try ./file_name in the directory your using. also I haven't tried programming in unix in a while but I thought it was cc filename flags, that may be out of order, check the docs.
 
Last edited:
thankz said:
I don't think someone who's new to c/c++ is going to use a text editor...
julian (OP) is not new to C/C++ - it's just been "a long time since [he] did any C/C++", so he's probably a bit rusty.

Everyone has a favorite text editor... I'd prefer to know how julian recalls programming from way back when, before suggesting something. You never know, he may be an old emacs hacker, or one of the original "ed" devs... iirc the default on knoppix is kwrite or kate - one of the KDE editors. They are usually pretty easy to use and one can try different one later.

Most people program in an IDE these days and it's pretty much de-rigeur for anything object oriented.
So getting used to the IDE is probably best advise here.

That will mean following a tutorial from online.
 
  • #10
Simon Bridge said:
Most people program in an IDE these days and it's pretty much de-rigeur for anything object oriented.
So getting used to the IDE is probably best advise here.
Personally, I can't stand most IDEs. They get in my way more than they help. That's my opinion; others have rather different opinions.


julian said:
I've used UNIX to do latex but that's all.

I got up a kDevelop window, I named a file called "pop". Typed in a sample programme.

I clicked on "Konsole" and a narrow window came up at the bottom. I tried typing in "g++ pop" and "gcc pop" and "c++ pop" to try to compile the programme but every times got the message
"pop: file not recognized: File format not recognized
collect2: ld returned 1 exit status"

You have to somehow let the compiler know the language the file is written in. You didn't do that. There are a couple of approaches. One approach is via the -x option to the compiler. Don't do that. The recommended approach is to use the appropriate file suffix. Name your file pop.c if you wrote a C program; use pop.C, pop.cc, pop.cxx, pop.cpp, or pop.c++ if you wrote a C++ program. You have lots of suffix choices for C++. Pick one and be consistent. I wouldn't use the .C (capital C) suffix, personally. That will get you in trouble on windows or Mac OS.

If you wrote a c++ program you want to use g++ to compile and link it. The gcc command invokes the c++ compiler if gcc recognizes the file as a c++ source file but it does not automatically use the C++ library for linking. You have to manually specify the c++ library on the command line when you use gcc to compile and link your program. Those worries go away if you use g++ instead of gcc.
 
Last edited:
  • #11
Thanks all. I'm up and running.
 
  • #12
Cheers and have fun :)
 

Similar threads

  • · Replies 22 ·
Replies
22
Views
3K
Replies
6
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
9
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 86 ·
3
Replies
86
Views
13K
Replies
5
Views
8K
  • · Replies 29 ·
Replies
29
Views
8K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K