C Board  

Go Back   C Board > Community Boards > Tech Board

Reply
 
LinkBack Thread Tools Display Modes
Old 12-16-2005, 10:34 PM   #1
Registered User
 
Join Date: Apr 2003
Posts: 2,662
dev c++: braces, auto completion, etc.

Hi,

In the dev c++ editor, this is what I get when I type a closing brace:
Code:
for(int i = 0; i<10; i++)
{
       cout<<i<<endl;

       }
What setting do I need to change to get the closing brace to match the indent of the first brace?

Also, is there a way I can set auto completion? For instance, can I make a custom setting so that when I type "fo" and then hit the space bar, a for loop is entered into the code?

Thanks.
7stud is offline   Reply With Quote
Old 12-17-2005, 02:51 AM   #2
SSDD
 
Join Date: Jan 2005
Posts: 369
It should auto align immediately, if you don't put another newline after the preceding statement.

Code:
#include <iostream> //basic io

using namespace std;

int main()
{
    for(int i=0; i<10; i++)
    {
        cout<<i<<endl;//<-- You had an extra carriage return here
    }
}
I'm not sure about the other, but perhaps you could use shortkeys?

http://www.shortkeys.com/

Oh and one other thing, you can change the style of code to look like visual studio.

Tools>editor options>syntax>colour speed settings.

Another handy hint which I found is you can highlight matching braces...

Tools>editor options>general
... Then tick the "highlighting braces" box.


File>new>project>multimedia ... woot OpenGL as well!!!

Last edited by treenef; 12-17-2005 at 03:16 AM.
treenef is offline   Reply With Quote
Old 12-17-2005, 11:38 AM   #3
Registered User
 
Join Date: Apr 2003
Posts: 2,662
Hi,

Thanks for the response. I still can't get the braces to line up. When I type the ending semicolon on the preceding line and then hit return, the cursor lines up with the beginning of the preceding line. Like other editors, I expect that when I type a closing brace, the editor will automatically backspace one indent and line up the closing brace with the opening brace, but as I posted that isn't what is happening. If I try backspacing once, the cursor will line up under the opening brace, but when I type the closing brace the editor indents it all the way to the left to match the opening brace of main().

Last edited by 7stud; 12-17-2005 at 11:44 AM.
7stud is offline   Reply With Quote
Old 12-17-2005, 12:24 PM   #4
SSDD
 
Join Date: Jan 2005
Posts: 369
That's odd,

Although I have heard that Dev c++ has some problems with its editor. And I've also noticed the formating gets totally messed up when you cut and paste chunks into the editor.

What version are you using? I'm using 4.9.9.0.

Here's my settings btw, I'm not sure if this will help (I don't use the tab key either, I let the editor do it for me):- If you use the tab key this may be your problem-
Attached Images
 

Last edited by treenef; 12-17-2005 at 12:39 PM.
treenef is offline   Reply With Quote
Old 12-17-2005, 01:07 PM   #5
Registered User
 
Join Date: Apr 2003
Posts: 2,662
I'm using the latest version: 4.9.9.2 which I downloaded yesterday. I have the same settings as you do.

At this point, I have to say I'm a bit disappointed in dev c++.
7stud is offline   Reply With Quote
Old 12-17-2005, 02:03 PM   #6
Devil's Advocate
 
SlyMaelstrom's Avatar
 
Join Date: May 2004
Location: Out of scope
Posts: 3,778
I've only used Dev-C++ thus far. I've made an attempt at downloading VC++, but I gotta install SP2, and before I do that I have to reformat this PC... which I'm slow to getting around to.

I've heard CodeBlocks was a nice IDE, but I don't know from experience. As for Dev-C++... the IDE could use some work and as far as compiling goes, I have no idea how good it is, but it works and it's all I've used.
__________________
Terms of Service
By quoting or replying directly to this post, you consent to the fact that all of the information in the post above is completely accurate and highly intelligent and no comments will be made towards its validity, thoughtlessness, and/or grammatical structure.

Violators will be prosecuted to the fullest extent of the law.
SlyMaelstrom is offline   Reply With Quote
Old 12-17-2005, 04:03 PM   #7
SSDD
 
Join Date: Jan 2005
Posts: 369
Dev c++ will never be as polished as Micro$oft.


But that doesn't make it any less powerful. It does most of the things any programmer would need. Compiles in C or C++, allows you to create windows programs and use OpenGL.

Admittedly, if you are considering programming for a living, Dev probably won't meet you're needs. It's lack of the .net framework would be an obvious point to mention.

However, in spite of this, there are many good things to say about Dev c++. My advice would be to stick with it. Most IDE's take some getting used to. A few tweaks here and there...who knows you may actually come to like it.

May I ask why you've decided to change IDE?
treenef is offline   Reply With Quote
Old 12-17-2005, 04:22 PM   #8
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
Quote:
Originally Posted by treenef
Admittedly, if you are considering programming for a living, Dev probably won't meet you're needs. It's lack of the .net framework would be an obvious point to mention.
Nah, it wouldn't. Dev-C++ is for C++, not C# or that hybrid atrocity called Managed C++.
If you want .Net, get SharpDevelop.
__________________
All the buzzt!
CornedBee

"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
CornedBee is offline   Reply With Quote
Old 12-17-2005, 10:22 PM   #9
Registered User
 
Bajanine's Avatar
 
Join Date: Dec 2001
Location: The most peaks over 10,000 feet!
Posts: 388
Just uncheck 'Smart Tabs'
Attached Images
 
__________________
"A government big enough to give you everything you want, is big enough to take away everything you have." - Thomas Jefferson
MSVS 2008 Pro / DevPartner / CB NightlyBuilds / MinGW / Cygwin
Bajanine is offline   Reply With Quote
Old 12-17-2005, 10:34 PM   #10
Registered User
 
Join Date: Apr 2003
Posts: 2,662
Thanks! Unchecking smart tabs has it working. What the heck is smart tabs anyway?

Before I did that I had tried some other code examples, and not only did I have the matching brace indent problem, but every section of code was indented a different amount. I was getting ready to delete the whole IDE and write it off as a piece of junk. I'll see if it works better now.
7stud is offline   Reply With Quote
Old 12-17-2005, 10:40 PM   #11
Registered User
 
Bajanine's Avatar
 
Join Date: Dec 2001
Location: The most peaks over 10,000 feet!
Posts: 388
I don't know exactly what smart tabs are supposed to do. I was quite frustratred with the editor options so I just poked around til I got what I wanted. I still prefer to use MSVS.net 2003 IDE, but I dabble with Bloodshed for grins.
__________________
"A government big enough to give you everything you want, is big enough to take away everything you have." - Thomas Jefferson
MSVS 2008 Pro / DevPartner / CB NightlyBuilds / MinGW / Cygwin

Last edited by Bajanine; 12-17-2005 at 10:43 PM.
Bajanine is offline   Reply With Quote
Old 01-07-2006, 06:04 PM   #12
Registered User
 
Join Date: Dec 2005
Posts: 32
I've also been a bit annoyed by various bugs in Dev-Cpp and when I saw you talking about Code::Blocks - an IDE I've never heard of - I decided to give it a go. It's GPL'ed and really neat! I haven't had time to play around with it that much yet, but for starters I'm really impressed!
tretton is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual studio - intellisense - auto completion nacho4d C++ Programming 5 06-02-2009 09:50 AM
error: braces around scalar initializer... Osiris990 C++ Programming 2 02-27-2008 03:22 PM
Glut and Dev C++, Programs not Quitting? Zeusbwr Game Programming 13 11-29-2004 08:43 PM
Code: An auto expanding array (or how to use gets() safely). anonytmouse Windows Programming 0 08-10-2004 12:13 AM
Overlapped I/O and Completion Port :: Winsock kuphryn Windows Programming 0 10-30-2002 05:14 PM


All times are GMT -6. The time now is 05:33 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22