dev c++: braces, auto completion, etc.

This is a discussion on dev c++: braces, auto completion, etc. within the Tech Board forums, part of the Community Boards category; Hi, In the dev c++ editor, this is what I get when I type a closing brace: Code: for(int i ...

  1. #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.

  2. #2
    Super Moderater.
    Join Date
    Jan 2005
    Posts
    374
    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 02:16 AM.

  3. #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 10:44 AM.

  4. #4
    Super Moderater.
    Join Date
    Jan 2005
    Posts
    374
    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 Attached Images  
    Last edited by treenef; 12-17-2005 at 11:39 AM.

  5. #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++.

  6. #6
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,069
    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.
    Sent from my iPadŽ

  7. #7
    Super Moderater.
    Join Date
    Jan 2005
    Posts
    374
    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?

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    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

  9. #9
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Just uncheck 'Smart Tabs'
    Attached Images Attached Images  
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  10. #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.

  11. #11
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    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.
    Last edited by Bajanine; 12-17-2005 at 09:43 PM.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  12. #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!

Popular pages Recent additions subscribe to a feed

Similar Threads

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

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