You are not logged in.

#1 2013-01-13 16:32:00

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

[SOLVED] Kate: How can I create C++ files?

Hello,

I have installed Kate, but I didn't understand how I can create source files. Clicking on New, it makes only a text document.


Grant.

Last edited by Grant (2013-01-14 13:35:43)

Offline

#2 2013-01-13 16:37:54

derhamster
Member
Registered: 2012-07-08
Posts: 86

Re: [SOLVED] Kate: How can I create C++ files?

What are you expecting specifically? Some kind of code templates? TBH, I haven't used Kate in a long time and don't remember if it provides something like that.

Offline

#3 2013-01-13 16:43:23

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Re: [SOLVED] Kate: How can I create C++ files?

No, I don't want any templates. I want create some C++ files, and not simples text files.
What IDE do you use? Or only a text editor?

Offline

#4 2013-01-13 16:57:37

derhamster
Member
Registered: 2012-07-08
Posts: 86

Re: [SOLVED] Kate: How can I create C++ files?

C++ files are simple text files. Programming languages are written in plain text files and usually don't require an IDE. Any text editor will do.
If you wan't to learn C++, you should probably pick up a good book. If its not specifically C++, consider trying a different language first. C++ is not very beginner friendly.

Offline

#5 2013-01-13 17:15:31

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Re: [SOLVED] Kate: How can I create C++ files?

I know these things. C++ files are text files: but have a "special" extension. It isn't .txt but .cpp for example. A compiler won't accept a .txt file.
I only wanted to know how I can create these files from the program. Trying to create a file, save it with .cpp extension, it gets the syntax highlighting. Is possible to make directly a C++ file?
Before I tried KDevelop: is possible to use gcc/g++ instead cmake?

Offline

#6 2013-01-13 17:28:05

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,694

Re: [SOLVED] Kate: How can I create C++ files?

So this whole thing is about a filename? Are you kidding me?

Save the file as whatever you want, who cares?

Offline

#7 2013-01-13 17:33:03

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Re: [SOLVED] Kate: How can I create C++ files?

I want to make a C++ file from Kate: is possible and how?

Offline

#8 2013-01-13 17:34:39

mcmillan
Member
Registered: 2006-04-06
Posts: 737

Re: [SOLVED] Kate: How can I create C++ files?

Grant wrote:

I know these things. C++ files are text files: but have a "special" extension. It isn't .txt but .cpp for example. A compiler won't accept a .txt file.
I only wanted to know how I can create these files from the program. Trying to create a file, save it with .cpp extension, it gets the syntax highlighting. Is possible to make directly a C++ file?
Before I tried KDevelop: is possible to use gcc/g++ instead cmake?

I'm still very confused about what you're expecting. You can just save a file with the .cpp as part of the file name. If that's not working for you post the results of trying to compile and the command

file $filename 

Here's what I got out of file I had in my pkgbuild folder

andy@odin> file application.cpp
application.cpp: C source, ASCII text

and one I created with kate and just named along with pasting a couple lines from another file

andy@odin> file test.cpp
test.cpp: C source, ASCII text

Offline

#9 2013-01-13 17:50:30

masteryod
Member
Registered: 2010-05-19
Posts: 433

Re: [SOLVED] Kate: How can I create C++ files?

You can write c++ file in any text editor, vim, nano, emacs, gedit, kate etc. But you won't be able to compile from within it - there is no button for compilation in simple text editors.

You can also use IDE for c++ programming (eclipse, kdevelop...) to get advanced stuff like compiling, project management etc.

Kate is advanced text editor with tools and extensions aimed at developers. By default you've got nice things like syntax highlighting which can help you writing code - maybe this is what you were asking for in the first post? If so just enable it in tools menu. You've got also code snippets under ctrl+space shortcut. And many many other things made for c++ just spend 5 seconds with Kate and try to learn it.

Last edited by masteryod (2013-01-13 17:56:58)

Offline

#10 2013-01-13 18:03:10

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Re: [SOLVED] Kate: How can I create C++ files?

masteryod wrote:

Kate is advanced text editor with tools and extensions aimed at developers. By default you've got nice things like syntax highlighting which can help you writing code - maybe this is what you were asking for in the first post?

Nope...

I would create a C++ source file from Kate. I would that Kate creates a .cpp file instead .txt as default. Is clear or not?

Last edited by Grant (2013-01-13 18:03:36)

Offline

#11 2013-01-13 18:21:05

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,694

Re: [SOLVED] Kate: How can I create C++ files?

Grant wrote:

I would create a C++ source file from Kate. I would that Kate creates a .cpp file instead .txt as default. Is clear or not?

What's not clear is that YOU determine the filename. This isn't Windows, the extensions don't matter. If you want a file to have a .cpp extension, save it with a .cpp extension. If that's too hard for you, you need to forget about C++.

Offline

#12 2013-01-13 18:26:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] Kate: How can I create C++ files?

Perhaps, and I'm stretching here because this is very odd, but perhaps the problem is that when a new (blank) file is opened, it does not have any syntax highlighting until it is saved with an extension.

So one could not just open a new file and start typing C++ code and get highlighting.  You'd have to open a new document, save it as somefile.cpp first.

There should be a way to set the highlighting mode for the default buffer.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#13 2013-01-13 18:51:32

Awebb
Member
Registered: 2010-05-06
Posts: 6,688

Re: [SOLVED] Kate: How can I create C++ files?

OP wants kate to save files as .cpp by default, without OP having to type .cpp all the time. Kate will not do that, as far as I know. It will always assume .txt. I don't understand, why this is a bother, but everyone to its own.

Last edited by Awebb (2013-01-13 18:51:58)

Offline

#14 2013-01-13 19:21:12

masteryod
Member
Registered: 2010-05-19
Posts: 433

Re: [SOLVED] Kate: How can I create C++ files?

Grant wrote:

Nope...

I would create a C++ source file from Kate. I would that Kate creates a .cpp file instead .txt as default. Is clear or not?

Try templates plugin: http://docs.kde.org/stable/en/kde-basea … plate.html
With this Kate should save file as .cpp file(?) can't test it, I don't have kdepim package and I don't want to install it.

Also, any one knows what Automatically select filename extensions option do and why it's grayed out in "save as" dialog?

PS there is "build" plugin if you're interested so you'll have button for compilation.

Last edited by masteryod (2013-01-13 19:25:37)

Offline

#15 2013-01-13 20:27:41

derhamster
Member
Registered: 2012-07-08
Posts: 86

Re: [SOLVED] Kate: How can I create C++ files?

The filename is the problem?! If the .txt default bothers you so much, use a different editor.

Offline

#16 2013-01-13 21:39:57

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Re: [SOLVED] Kate: How can I create C++ files?

Ok, so I have to create the file and save it to get the syntax highlighting. This is what I wanted to know.
Thanks to all participants.

Offline

#17 2013-01-14 03:45:31

mcmillan
Member
Registered: 2006-04-06
Posts: 737

Re: [SOLVED] Kate: How can I create C++ files?

If you have the answer you need edit the post title to say [solved]

Offline

#18 2013-01-14 17:01:13

masteryod
Member
Registered: 2010-05-19
Posts: 433

Re: [SOLVED] Kate: How can I create C++ files?

Grant wrote:
masteryod wrote:

Kate is advanced text editor with tools and extensions aimed at developers. By default you've got nice things like syntax highlighting which can help you writing code - maybe this is what you were asking for in the first post?

Nope...

but then...

Grant wrote:

Ok, so I have to create the file and save it to get the syntax highlighting. This is what I wanted to know.

Offline

Board footer

Powered by FluxBB