Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: Lily on August 23, 2011, 06:26:11 pm
-
Hi,
I'm new to C++ and I'm trying different IDE to find the one I'll be more confortable with.
I am trying CodeBlock since it's the one that is widely advised and indeed it feels quite confortable. :)
I have a question though.
I tried Eclipse CDT (just because I'm very used to Eclipse since I'm using it for JAVA and ActionScript) and there is a feature to generate class implementation from class header. It saves a lot of time.
I couldn't find the same feature in CodeBlock. Does it exist ? Or is there a better way to work ? I guess there is a better way than copy/paste and clean the header file in the implementation file... so what's the fastest way to implement a class in CodeBlock ?
If you wonder what I'm not going on with Eclipse CDT then : well, it's very nice but on my Ubuntu (Natty Narwhal), CDT started crashing after a few small c++ exercices. The console or debugger kept crashing and I had to reinstall it to be able to use it again. It makes me think that it could be a bit unstable and since CodeBlock is widely acclaimed...
Thanks for you help and sorry for the english, it's not my mother tongue
Lily
-
This feature exist.
Go in your .cpp file, right clic somewhere, go to "insert" sub-menu and select "All class methods without implementation"
For the CDT use... I have to use eclipse in study, and I can't understand what people find to this... thing. But because here is not the subject, I won't explain why I don't like it. (But BTW, if someone know a better IDE for JAVA I'll take it!)
-
Thank you very much ! It works very well :D
I have a question though. It's more about good practice in C++.
I'm learning with a book in which they put the javadoc-like documentation on top of the declaration of each method in the header file. I'm talking about the documentation that looks like this :
/** This method does this or that.
* @param arg Description of the param
* @return Description of the return value
*/
Then there's no comments in between methods in the cpp file.
It's also how Eclipse CDT automatically generates them.
I see that Codeblock automatically writes those in the cpp file with the method you gave me. And doesn't write any comments in the header file.
I check CodeLite and it doesn't put any comments at all. :?
So, what is best practice in c++ ? Should I put the documentation for the methods and variables in the header file or in the cpp file ? :(
It feels like it's easier to read in the header file but I just want to make sure it's the proper way to do it.
And if so, is there a way to remove those comments from what CodeBlock generates ?
-
I check CodeLite and it doesn't put any comments at all.
In codelite, place your caret on the function name and hit 'Ctrl-Shift-D' or Right Click -> Code Generation / Refactoring / -> Insert Doxygen comment
The format of the comment can be modified from: "Setting | Global Editor Preferences | C++ | Doxygen"
Eran
-
I see that Codeblock automatically writes those in the cpp file with the method you gave me. And doesn't write any comments in the header file.
If you use File->New->Class..., it has the option of generating comments in the created header file.
So, what is best practice in c++ ? Should I put the documentation for the methods and variables in the header file or in the cpp file ? :(
Most of the time, you will want the API (how a function is used) documentation in the header file, and the implementation (how a function works) documentation in the cpp. If you are using a nightly/SVN build, generating block comments on-demand is simple: put the cursor on the declaration and press Ctrl-Alt-B or right click->DoxyBlocks->Block Comment or from the menu bar DoxyBlocks->Block Comment.
-
Thanks both of you :)