jEdit Community - Resources for users of the jEdit Text Editor
Compiling C++
Submitted by Anonymous on Wednesday, 21 January, 2004 - 19:11
Hello all!
Is there a simple way to compile c++ in JEdit?

Johan
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
I know this post is old, but...
by tupperduck on Sun, 07/03/2004 - 14:15
I just started learning C++ and, as a part of that, decided to try jEdit. The first question I had was "how do you compile C++ with it"? I found this thread, but unfortunately, there were no responses.

Here is what I did: (I am using Windows 2000)

1) Install the Console plugin (Plugins > Plugin Manager > Install Plugins)
2) Create a macro to invoke the compiler. Either:

Macro > Record Macro, then open the Console and type:
cd ${d}
[compiler command] ${f}
e.g. I am using DigitalMars C++ compiler so the second line for me would be "dmc ${f}"
Macro > Stop Recording, then save your new Macro.
OR
Create a new page and type:
runCommandInConsole(view,"System","cd ${d}");
runCommandInConsole(view,"System","dmc ${f}");
* Change "dmc" in the second line to match whatever command runs your compiler.
Save it as a .bsh file in C:\Documents and Settings\[user]\.jedit\macros.
3) Go to Utilities > Global Options > Shortcuts and select Macros from the drop-down list at the top.
4) Find the name of the Macro you just created and assign a shortcut key to it. Apply. Ok. And you're done.

This will allow you to compile whatever file is currently being viewed.

A few notes:
- ${d} returns the directory path of the current file. When creating the Macros, if you do not want the resulting .exe (and associated files) in the same directory as the file being compiled, change the path accordingly in Step 3.
- ${f} returns the current file name.
- As an aside, I have noticed that running C++ exe's that require user input (e.g. std::cin >> x) doesn't work well in the jEdit Console-- it doesn't stop to allow user input; it runs as if the user entered nothing. (If I run the same exe's from a DOS prompt, it works fine, but I am still new to both C++ and jEdit, so maybe it's me.)

I am not sure if the above qualifies as "simple", but once it is set up, it works well. Type-type-type, save, shortcut key to compile, drops me right into the Console, run the .exe, hooray I am happy. (Admittedly, I am not sure how useful this is for more advanced C++ projects, but for short, smaller programs-- as when learning C++-- it is dandy.)

 
getting older and better...
by Anonymous on Sun, 09/01/2005 - 23:37
I used commando-files up to now, but I think your solution is better.

I just added following to the macro:

jEdit.saveAllBuffers(view,false);

This saves automatically all files -> real one-push solution. If you want the confirm the save all every time, just remove the false.

I have a identically called makefile in every project-folder->always the right project for the select file gets compiled.

Thomas

P.S.: To get things complete for other newbies like me: I use the Errorlist-plug-in to get a useful error-display.
User login
Browse archives
« September 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   98100
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17480
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300