Working comfortably in C using Eclipse - c

Umm, I've been using Eclipse for Java development and I am trying to use it now for making C apps.
The problem is that I don't feel too comfortable with it. Namely:
I need to include headers by hand, i.e. not automatically.
I've never seen a 'quickfix' to be available for any problem.
I can't spot the problem before it has been compiled.
Any ideas on how I could make myself feel a bit better?
Sorry if my questions are rather stupid, but getting the way down from Java to C is rather hard on me.
Thanks!

Yeah its a little harder to go from Java to C, Java didn't exist when I was programming C.
Some comments:
Automatically including headers is difficult in C
See #include headers in C/C++
You could use lint to catch some errors...
http://syncor.blogspot.com/2010/03/using-lint-in-eclipse-with-netburner.html
Consider doing TDD using something like gTest, and automate your build process.
http://www.slideshare.net/amritayan/test-driven-development-in-c, might help you develop a different rhythm.
gtest in Eclipse ... https://github.com/ospector/gtest-gbar
Have fun!

On Mac OS XCode is an option.
On startup:
New Application -> Command Line Tool ->Type C
And Bob is your proverbial (aunty).
You get all the XCode short cuts & hit ESC in your editor window for code completion.
Hmmm.... think I'll start using it actually. ;-)

re:
I can't spot the problem before it has
been compiled.
You can get immediate feedback on syntax errors. They show up as question marks in the left gutter and yellow squiggly lines under the error. This happens immediately. Make sure under Window->Preferences-General->Editors->Text Editors->Annotations that you have the "Show in" checkboxes checked for the C/C++ Indexer Markers and C/C++ Occurrences.

Related

Gtk on Dev C or C in general

I need to use gtk on Dev C++ and i have tried installing MSYS2 but there are only guides for other development enviroment like Code blocks.
I have followed this guide https://stackoverflow.com/questions/37737020/install-gtk-for-c-on-windows-10 to the "pacman -S mingw-w64-x86_64-toolchain" point.
What can i do from that point on to be able to use <gtk/gtk.h> libraries on DevC?
If i have taken a completely mistaken direction don't hesitate to tell me.
Thanks in advance
I have seen many people saying there are better ways to do it but i am interested in learning something about graphic interfaces and had a specific request from a professor to do this in C.

Starting with C using eclipse

I wanted to start programming with C, just because it is still important, and you need it for many study paths.
So i used eclipse before for programming java (just basics), and saw that you can use it for c/c++ too by installing other features. But I don't understand how to get it working, i tried several guides, but they were all outdated. I don't know how to link a compiler to eclipse, or whatelse I need.
ps: Sorry if my english may sound a little odd, I'm from germany.
please follow this link you can download
https://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/lunar

Conio2.h in CodeBlocks

first I want to apologize for my bad English and second for this topic, I didnt find anything like this so I create it.
My problem is:
I want to create a game where I want to use conio2.h, but problem is, that I cant find it on the internet. Still I find something with Linux, but I need it on windows. Im using CodeBlocks, it is good program but it doesnt have this library
Can you help me guys?
Conio is an old MS-DOS header. You will not find it in modern compilers. For Unix/Linux systems, you can use curses, Windows Systems have their own libraries and functions.
You may want to ask a question on how to do something specific you are having problems with and posting some code.
For example, setting the cursor position can be done with SetConsoleCursorPosition .

Recommended for learning C

What could some of you recommend for using when learning C and programming with C?
I have thought of the following options. (On OSX)
Aquamacs
TextMate and the Terminal
XCode
I want to learn more than just the IDE so that I grasp the concept as I will be learning about compilers etc.
I tried Aquamacs when learning Erlang but it was more of a hassle than I enjoyed.
Is there a lot extra to learn when using an Emacs environment?
What is most beneficial for understanding how things work. ( C )
Are there any other tools or possible options worth looking into?
Thanks
If what you want to learn is C Programming Language in Mac OS X I would go with XCode. It has a very good GDB integration, and its learning curve is smoother that EMACS' or just writing your own Makefiles.
If you want to learn about C, in my opinion, you should use the most basic editor available, compile using the terminal with gcc. And that's it.
Once you'll understand the language, picking one IDE over an other will be a no brainer.
But no IDE will really teach you anything about C.
There's also BBEdit on OSX. (I've used it briefly in the OS8 days.) As far as learning C goes, there are a number of books that you can try. I'd pop down to whatever chain bookstore is closest and browse the Programming section.
I'd also invest in a good algorithm book.
If you want to use Emacs as an IDE, you will need to write Makefile in order to be able to compile from within Emacs. Writing Makefile could help you understand the compiler options, object code, linking and such.
So to use Emacs as IDE for learning C, you should be using C-mode, know about M-x compile and using gdb under Emacs(M-x gdb). To look up man pages for library functions, M-x man and supply it (3 printf, for example to read the man page of C I/O function printf) the section number and function name.
I am not sure if using Emacs+Makefile this way is most beneficial in helping you teach how to compile, link, build etc, but it sure does help in learning those ideas.
If you're not comfortable using a more advanced editor like vim or emacs, then I would suggest using TextMate or something similar. This would let you concentrate on the code you're writing rather than struggling to learn how to use the editor.
Using a full blown IDE like XCode will also allow you to pretty much ignore the build system while you're still learning the language itself. Once you get comfortable with C, learning things like make or cmake would be less overwhelming.
Then after that, maybe you can go back to check out vim or emacs and see what a more complex editor can do for you, if anything.

What is the best IDE for C Development / Why use Emacs over an IDE? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
so as per one of my previous questions, I'm brushing up on my C skills.
My question is, what do people use for developing C?
Lots of people use Emacs, and have done so for years, but is it better to learn emacs than just use an IDE such as Geany or KDevelop?
Would also be interested to hear from those still using emacs, and why they use it over other apps?
Please note that I'm only really interested in the free IDEs / editors.
EDIT:
Thanks for posting links which answer some of my questions, but I guess what I'm really wondering about is:
Whether learning to edit using emacs / vim and compiling / debugging using the gcc-toolchain is worth it instead of just using an IDE, and why?
What are peoples reasons for not migrating to an IDE?
Has anyone moved from terminal-centric development to IDE development, and why did they move?
I started off by using IDEs, Microsoft or not. Then, while working on QNX some long time ago, I was forced to do with a text editor + compiler/linker. Now I prefer this simple combination––a syntax highlighting editor + C compiler and linker cli + make––to any IDEs, even if environment allows for them.
The reasons are, for me:
it's everywhere. If you program in C, you do have the compiler, and usually you can get yourself an editor. The first thing I do––I get myself nedit on Linux or Notepad++ on Windows. I would go with vi, but GUI editors provide for a better fonts, and that is important when you look at code all day
you can program remotely, via ssh, when you need to. And it does help a lot sometimes to be able to ssh into the target and do some quick things there
it keeps me close to CLI, preferably UNIX/Linux CLI. So all the commands are on my fingertips, and when I need them I don't have to go read a reference book. And UNIX CLI can do things IDEs often can't––because their developers didn't think you'd need them
most importantly, it is very much like seeing the Matrix in raw code. I operate files, so I'm forced to keep them manageable. I'm finding things in my code manually, which makes me keep it simple and organized. I do Config Management explicitly, so I know when I'm synced and how. I know my Makefiles because I write them, and they only do what I tell them to
(if you wonder if that works in "really big projects"––it does work, and the bigger the project the more performance it gains me)
when people ask me to look at their code, I don't have to learn the IDE they use
I've moved from a terminal text-editor+make environment to Eclipse for most of my projects. Spanning from C and C++, to Java and Python to name few languages I am currently working with.
The reason was simply productivity. I could not afford spending time and effort on keeping all projects "in my head" as other things got more important.
There are benefits of using the "hardcore" approach (terminal) - such as that you have a much thinner layer between yourself and the code which allows you to be a bit more productive when you're all "inside" the project and everything is on the top of your head. But I don't think it is possible to defend that way of working just for it's own sake when your mind is needed elsewhere.
Usually when you work with command line tools you will frequently have to solve a lot of boilerplate problems that will keep you from being productive. You will need to know the tools in detail to fully leverage their potentials. Also maintaining a project will take a lot more effort. Refactoring will lead to updates in make-files, etc.
To summarize: If you only work on one or two projects, preferably full-time without too much distractions, "terminal based coding" can be more productive than a full blown IDE. However, if you need to spend your thinking energy on something more important an IDE is definitely the way to go in order to keep productivity.
Make your choice accordingly.
Emacs is an IDE.
edit: OK, I'll elaborate. What is an IDE?
As a starting point, let's expand the acronym: Integrated Development Environment. To analyze this, I start from the end.
An environment is, generally speaking, the part of the world that surrounds the point of view. In this case, it is what we see on our monitor (perhaps hear from our speakers) and manipulate through our keyboard (and perhaps a mouse).
Development is what we want to do in this environment, its purpose, if you want. We use the environment to develop software. This defines what subparts we need: an editor, an interface to the REPL, resp. the compiler, an interface to the debugger, and access to online documentation (this list may not be exhaustive).
Integrated means that all parts of the environment are somehow under a uniform surface. In an IDE, we can access and use the different subparts with a minimum of switching; we don't have to leave our defined environment. This integration lets the different subparts interact better. For example, the editor can know about what language we write in, and give us symbol autocompletion, jump-to-definition, auto-indentation, syntax highlighting, etc.. It can get information from the compiler, automatically jump to errors, and highlight them. In most, if not all IDEs, the editor is naturally at the heart of the development process.
Emacs does all this, it does it with a wide range of languages and tasks, and it does it with excellence, since it is seamlessly expandable by the user wherever he misses anything.
Counterexample: you could develop using something like Notepad, access documentation through Firefox and XPdf, and steer the compiler and debugger from a shell. This would be a Development Environment, but it would not be integrated.
I have used Eclipse with the CDT plug in quite successfully.
Emacs would be better if it had a text editor in it... :-)
Use Code::Blocks. It has everything you need and a very clean GUI.
Netbeans has great C and C++ support. Some people complain that it's bloated and slow, but I've been using it almost exclusively for personal projects and love it. The code assistance feature is one of the best I've seen.
How come nobody mentions Bloodshed Devc++? Havent used it in a while, but i learnt c/c++ on it. very similar to MS Visual c++.
If you are looking for a free, nice looking, cross-platform editor, try Komodo Edit. It is not as powerful as Komodo IDE, however that isn't free. See feature chart.
Another free, extensible editor is jEdit. Crossplatform as it is 100% pure Java. Not the fastest IDE on earth, but for Java actually very fast, very flexible, not that nice looking though.
Both have very sophisticated code folding, syntax highlighting (for all languages you can think of!) and are very flexible regarding configuring it for you personal needs. jEdit is BTW very easy to extend to add whatever feature you may need there (it has an ultra simple scripting language, that looks like Java, but is actually "scripted").
If you're on Windows then it's a total no-brainer: Get Visual C++ Express.

Resources