C C programming best IDE for FreeBSD -- can't find one

… with the hope that this post will make it into a how to:

General idea, and a good start -- one page read about FreeBSD and in particular leading to “Introduction to Programming”: https://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/tools-programming.html

However, a quick summary:
1. interpreters: BASIC, Lisp, Perl, Scheme, Icon, Logo, Python, Ruby, Tcl and Tk (sh, csh)

2. compilers: edit-compile-run-debug cycle -- expected as common procedures when coding

FreeBSD does not include an IDE in the base system, (but devel/kdevelop is available (favoritism))
Using Emacs as an IDE is discussed in Section 2.7, “Using Emacs as a Development Environment”.

AHR opinion is that any form of IDE requires additional knowledge and as such many quit before touching C language. Nevertheless, ambiguity is created even for those with some experience but new to FreeBSD.

...
Compiling with cc
https://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/tools-compiling.html

Although this section was the question in my post but not enough to figure things out:
https://forums.freebsd.org/threads/55776/

...
1. Make -- make reads in a file, called a makefile
2. Makefiles are typically kept in the same directory as the source they apply to
3. Standards: Most programmers use the name Makefile (note uppercase M -- aka Title case)

REM: mkdir /path/home/code; ee /path/home/code/Makefile
*** Standards: /usr/ports/category/portname

Note: I used ee in the example but Nano, Vim or any other text editor can be employed to create the file/s.

- Makefile contains dependencies and commands:
- The dependency line in this example consists of the name of the program (known as the target)

Simple content of Makefile (consists of two lines, a dependency line and a creation line)
Code:
foo: foo.c
     cc -o foo foo.c

Syntax of dependency line is:
foo: (is the name of the program/code aka “the target” (you execute this file))
foo.c (is the raw code file (you write this file))
REM: target followed by colons, and by whitespace, then C lang. code file

Syntax of creation line is: (command)
cc (is the compiler used (but you may call gcc))
-o (switch used for CC)
foo (is the dependency (exe))
foo.c (is the code to be compiled)
REM: command line starts with a TAB (5 characters exact -- I guess, “make” will not know otherwise how to interpret the cmd line)


Create the raw C programing with any editor
ee foo.c


Compile the raw code
make foo


Execute the code
./foo


*** The install: part is not covered as it is not the purpose of this tutorial. However, install is the easier part.

Practical step by step example:

1. create a location for your project and cd into it
mkdir /xample
cd /xample


2. create the Makefile for such project
ee Makefile

Code:
# mine looks like this and the target is "welcome"
echo "welcome: welcome.c" > Makefile && \
printf "\tcc -o welcome welcome.c" >> Makefile && \
echo ""; echo ""; && \
cat Makefile

3. Create the raw C program "welcome.c"
ee welcome.c

Code:
# mine looks like this
echo "#include <stdio.h>" > welcome.c && \
echo "" >> welcome.c && \
echo "int main(void) {" >> welcome.c && \
printf '\tprintf("Welcome to C programming!\\n");\n\treturn 0;\n}\n' >> welcome.c && \
echo ""; echo ""; && \
cat welcome.c


4. compile the raw code "welcome" (make target)
make welcome


5. Execute the program/code
./welcome
 
Last edited:
Practical step by step Zirias example:

1. create a location for your project and cd into it
mkdir /xample
cd /xample


2. create the Makefile for such project
ee Makefile
Code:
.c:
     $(CC) -o $@ $<

Code:
# Ziria's Makefile
echo ".c:" > Makefile && \
printf "\t$(CC) -o $@ $<" >> Makefile && \
echo ""; echo ""; && \
cat Makefile
3. Create the raw C program "welcome.c"
ee welcome.c

Code:
# mine looks like this
echo "#include <stdio.h>" > welcome.c && \
echo "" >> welcome.c && \
echo "int main(void) {" >> welcome.c && \
printf '\tprintf("Welcome to C programming!\\n");\n\treturn 0;\n}\n' >> welcome.c && \
echo ""; echo ""; && \
cat welcome.c

4. compile the raw code "welcome" (make target)
make welcome

5. Execute the program
./welcome
 
Just a vision but a little more evolved idea on same subject “compiling and executing C programing”:

https://forums.freebsd.org/threads/56456/

For those who didn’t observed a point, the idea behind this tread is that Makefile (make) is not necessary (to compile and execute) and it is rather a standard -- say the FreeBSD standards.
 
I am not entirely sure about this thread but I agree that a command-line based development environment is what I prefer.

I might add though that this setup is not exactly unique to FreeBSD, Linux, UNIX or even Windows.

For example, in Windows just open up the command prompt and you can use a similar setup.
  • cl - The c / c++ compiler, akin to cc, clang, gcc, suncc, etc...
  • nmake - The make utility, akin to make, bmake, gmake etc...
Visual Studio since version 6 has been regressing but these tools always stay the same.

But lets be honest, CMake or autotools is the way to go anyway so touching these programs directly is a little bit "scrappy" and non-standard.
 
AHR Inc These types of threads are bountiful all over the internet. They all offer the same answers with the same IDEs. It all boils down to personal preference unless dictated by work. The same suggestions for other operating systems, except for Windows, also apply to FreeBSD. That is why you won't get any new suggestions cause it's a topic I (at least) am bored to death with. On Stackoverflow, it will get deleted as "opinion".

So install one, try it yourself, see if you like it. If you install what someone else suggests, you may not like it anyway and wind up doing the same thing.
 
May the source be with you:

Sorry folks, sometimes I am moody but that is because too much reading and the outcome is left for “another day” – can’t get it right from the “first try” while time (affecting factor) is what I believe most of us including me have none at disposal – it is just a fact of life.

And yes, a reason for scripting it is a form of writing a memo. However, a good tutorial (including examples) is what most of time saves the day. “One page tutorial may be better than a whole book of reading – and even this one is a memo”.

As far as I am concerned “although I can’t see everything” – it is a good post RE: FreeBSD and C language programming! – At least we didn’t miss the fun. Nevertheless, the IDE was the excuse (some may say the hook). Oh yes, “I am already hooked to it”.

Further and for the sole purpose to influence “the learning”: (just an opinion written on bases of the discussed subject and not to reaching the point of building a port – e.g. welcome to C programming (maybe we should try a post on this notion – but participation is a key))



Thank you for reading,

PS: would I ever include everything in a one page tutorial? (oh, don’t forget to comment on RE which is not REM) … and last “we didn’t result in a one page tutorial yet, otherwise we should see a link to it”



Other issues regarding (RE) “welcome to C programming” – some essentials with references to details:

1. (Simulation) Assuming we create a location for a project (not a port, neither a build), in general we do not want to touch or alter the system, then for verification purposes we compile and run some C programming code.

2. Standards (the FreeBSD way) is the avenue to building ports – but we’re going too far if one page tutorial was the prospective. Link to another step of learning process is making sense.

3. Attaching a reference database e.g. “bible” to such project. (may be too much but an IDE will help you with references, and not impossible to include or think about it)

4. Format of post-answers it is preferable to say “influenced” to write a better material although it all depends on the reader mood and emancipation.

5. Overall, taking a small block of code as a project it is a way to learn faster.

*** With very few exemption, everyone participated on this post had added something very useful and worth reading on the subject. The IDE is getting better actually and I know it is not about an IDE as it is about FreeBSD and the high expectations.
 
I've been using something called cream (editors/cream). It is built on top of vim and has a lot of functionality for C coding.
 
I have been using editors/codelite for some time now, and find it impressive. After converting 90% of my coworkers to this (there is the resistance of vi users, you know ;) ), I really need to arrange for the company to make some donation there. It really saves us a lot of trouble and time.
 
I use vim with (recently) lldb or (previously) gdb but Geany is a nice IDE (probably just an editor with nice GUI) written in C fast an light and work perfectly on FreeBSD
 
Any IDE that doesn't lock you to a specific compiler is good with me.

We have quite a problem with the students at the University where I work becoming addicted to Visual Studio and having a really hard time when developing for Android or missing out on things like Emscripten to compile up their software for their portfolio website.

Back in the MSDOS days where switching out of programs was difficult, I saw the point of things like Borland's "Turbo" IDE, but now with the ability to have multiple Windows or a decent terminal multiplexer, avoiding monolithic tools is a good idea and keeping with small dynamic programs is seemingly better. That way to use a new tool, you don't need to replace your entire workflow, just a small component instead.

That said, for MSDOS, check out Watcom's Vi. (Some images in the guide) http://froebe.net/blog/wp-content/u...tor-Reference-and-Users-Guide-Open-Watcom.pdf

This worked really well on MSDOS and powered the Watcom compiler really nicely via wmake. The OpenWatcom site does a binary for Linux and Win32.

Myself, I guess my IDE is vim, tmux, grep and cmake.
 
I tried Anjuta and Geany but in the end my workflow goes like this:
I like to keep a separate dev box so at first I was working off the RaspberryPi2. What I do is open 3 terminal windows and ssh in and pull up command prompt for compiling, then a window with ee with my source file and usually I keep a ytree window up so I can have a look at the directory. I usually have some sort of tutorial on the browser too for my help system.
I use Xfce4 on my daily computer as it is very stable for me.

My course of studies has went backwards in some regards as I have much learning to do with Unix commands and shell scripting.
1)master BSD command prompt
2)learn advanced shell scripting
3)move forward into C programming and ncurses/dialog

After all shell scripts are like pre-programming exercises anyways. Like pre-calculus. Just a way to ease you in.

My most recent textbook purchase was SED and AWK pocket reference from OReilly (2002). I have been compiling a library of cheap used books.
 
What's cool is I see one thing repeated here: Borland tools from the late 1990's were very usable for writing applications.

With zero experience I made a program to flip some bits in a video file header.

Borland C++ Builder made it possible for someone with little experience.

I would say the IDE served its purpose for me. I had a quick project I needed done fast and the tools were intuitive and worked.

Yet here I am learning the old school method with flint and a rock..
 
[QUOTE="Phishfry, post: 347923, member: 47099" and usually I keep a ytree window up so I can have a look at the directory. I usually have some sort of tutorial on the browser too for my help system.
I use Xfce4 on my daily computer as it is very stable for me.
[/QUOTE]

I didn't know that there was a Unix version of XTree... I used to use that all the time under DOS. Thanks for pointing it out.
 
If you use ee like me I change the environment so the ytree edit shell feature works as I need.
sentenv EDITOR ee

I also don't care for appending the root directory slash but its is the view I usually want.
ytree /
 
Btw, have you read this book?
I just got it for 4 bucks.
http://www.ebay.com/itm/222443867794
"Eastern Economy Edition"

Thanks for the suggestion.

Checkout the lineage of this book
http://www.ebay.com/itm/262818030944

The-Elements-of-Programming-Style-by-Brian-W-Kernighan-and-P-J-Plauger-1974-
Ex-lib of IBM Systems Research Institute library

I can't help but think this might have passed through some tech titans hands.
http://www.nytimes.com/1981/08/30/education/ibm-a-giant-among-giants-in-the-classroom-as-well.html
 
I'd say give Anjuta a try... it's one of the best C IDEs that I have discovered so far.... And I mostly just use vi(1) for small projects, I.E. Kernel modules...
 
Like every thread in the universe created to ask this same question, the repetitive same answers abound and become circular. I hope this thread can be closed now.

Unfortunately, someone will inevitably come along and ask the question again. Hopefully, from now on, it can be closed with a link to this one or the "countless as the starry skies" number of same threads all over the internet universe.
 
Back
Top