Getting back into C++ with knoppix

  • C/C++
  • Thread starter julian
  • Start date
  • Tags
    C++
In summary, KDevelop is the graphical IDE for the GNU Compiler Collection - so that's what you want, yep.
  • #1
julian
Gold Member
812
316
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
  • #2
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.
 
  • #3
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.
 
  • #4
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.
 
  • #5
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 1 person
  • #6
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"
 
  • #7
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?
 
  • #8
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:
  • #9
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 :)
 

FAQ: Getting back into C++ with knoppix

1. What is Knoppix and why is it useful for learning C++?

Knoppix is a Linux-based operating system that runs entirely from a CD or USB drive without the need to install it on your computer. It is useful for learning C++ because it comes pre-installed with a variety of programming tools and libraries, making it easy to set up and get started with C++ programming.

2. How do I access the C++ compiler in Knoppix?

To access the C++ compiler in Knoppix, you can open a terminal window and type "g++" followed by the name of your C++ file. This will compile your code and create an executable file that you can run to see the output. Alternatively, you can also use a text editor like Gedit to write your code and then use the terminal to compile and run it.

3. Can I save my C++ code and projects in Knoppix?

Yes, you can save your C++ code and projects in Knoppix by using a USB drive or an external hard drive. You can also save your code on the Knoppix file system, but it will be lost when you shut down the system. It is recommended to save your code externally for easy access and to avoid losing your work.

4. Are there any resources or tutorials available for learning C++ with Knoppix?

Yes, there are many resources and tutorials available for learning C++ with Knoppix. You can find online tutorials, forums, and community support for Knoppix and C++ programming. You can also check out the official Knoppix website for documentation and user guides.

5. Is Knoppix suitable for advanced C++ programming?

While Knoppix is a great tool for learning C++, it may not be the best choice for advanced C++ programming. It is more suitable for beginners or for practicing and experimenting with C++ code. For advanced projects, you may want to consider using a dedicated programming environment or a different Linux distribution.

Back
Top