PDA

View Full Version : .elf format questions



FitzLT
July 13th, 2012, 05:13 PM
Hello everyone. Please excuse my noobness for second and bear with me.

I'm trying to get my feet wet with programming and just started watching the "C" video tutorials on WiBit.net(love those guys for creating that site!). I was getting ready to reinstall Windows on my computer because I had problems creating .exe files using GCC on Ubuntu 12.04. I did some research and found out that gcc defaults to the .elf format. I also read about the .bin format as well.

So here are my questions:

1) Is there any difference "real" between .elf and .bin formats?

2) Which is better(preferable) to use between the two?

3) If the .elf format contains so much information in the format, why is it not used instead of .deb/.rpm/.tgz/etc?

4) For ease of learning, should I install Windows and follow all of the tutorials, or learn the nuances on linux as I go along?

Thank you so much for any who takes the time to respond.

Bachstelze
July 13th, 2012, 05:39 PM
If you are just learning C, I think it's a bad idea to worry about such things. All you need to know is:

* Windows and Linux use different executable formats. Calling them just "Windows executables" and "Linux executables" is sufficient for now, without worrying about ELF and whatnot.

* In Windows, executables are denoted by the .exe extension. File extensions are a purely Windows concept, and do not exist in Linux, thus executables in Linux can have any filename. In particular, there is no obligation that executables end in ".exe". When you say you "had problems creating .exe files", I suspect you expected your executable to have a filename ending in .exe, and were surprised that it did not. In fact, that is perfectly normal.

If you are using Linux, I suggest you find Linux-centered resources to learn C. The sticky at the top of this forum probably has some.

FitzLT
July 13th, 2012, 06:49 PM
Fair enough. Throughout school, I was often told I had a very bad habit of "doing too much at one time". LOL. I guess I'm one of those "big picture" types...I like to know where all the little cogs fit together when I start working on, or learning, something.

However, I understand what you mean that I shouldn't worry about all of that for now.

I've scanned through the stickies before--there is definitely a wealth of information there. I'll go ahead and get started. Wish me luck!

Bachstelze
July 13th, 2012, 06:53 PM
Fair enough. Throughout school, I was often told I had a very bad habit of "doing too much at one time". LOL. I guess I'm one of those "big picture" types...I like to know where all the little cogs fit together when I start working on, or learning, something.


The point is precisely that by worrying too much about the details, you miss the big picture completely. This is a very, very common mistake among C programmers, even very experienced ones.

xb12x
July 13th, 2012, 11:01 PM
4) For ease of learning, should I install Windows and follow all of the tutorials, or learn the nuances on linux as I go along?

My personal preference would be to learn 'C' on Linux for these reasons:

1. All the tools you'll need are Open Source on Linux, which among other things means you won't need to spend money while learning. If you don't already have all the Windows tools be prepared to pay.

2. The GNU 'C' compiler on Linux is ANSI 'C' (ANSI is the American National Standards Institute). To work well with the entire Windows environment, Microsoft 'C' compilers are not 100% ANSI.

Bachstelze
July 13th, 2012, 11:08 PM
Why do you guys put "C" between quotes? Are you also learning "Python", or "English"?

As for your points, 1. is wrong. There are a lot of free C compilers for Windows.

xb12x
July 14th, 2012, 12:25 AM
Why do you guys put "C" between quotes? Are you also learning "Python", or "English"?

As for your points, 1. is wrong. There are a lot of free C compilers for Windows.


Over the years I got in the habit of putting 'C' in single quotes to differentiate from typos.

Microsoft does have free Express versions of development packages. The Express versions are limited compared to their commercial versions. See the Visual C++ 2010 Express | Microsoft Visual Studio package. That would be my first choice for a free 'C' compiler/tools package for Windows development.

As far as non-Microsoft free tools for Windows, they are not at all comprehensive solutions (very limited), they lack any real support, if any, and tend to be full of bugs.

But on Linux the normal, everyday development tools (compilers, IDEs, editors, you name it) are Open Source and freely available to anyone, just a download away. And (most importantly to me) are actively supported.

trent.josephsen
July 14th, 2012, 03:27 AM
The point is precisely that by worrying too much about the details, you miss the big picture completely. This is a very, very common mistake among C programmers, even very experienced ones.
I think this is a remarkably accurate insight.

FitzLT
July 15th, 2012, 02:00 AM
I think this is a remarkably accurate insight.

I completely agree.


Why do you guys put "C" between quotes? Are you also learning "Python", or "English"?


Sorry. I was "supposedly" doing it for readability sake. It is kind of silly when looked at it that way.;)


My personal preference would be to learn 'C' on Linux for these reasons:

1. All the tools you'll need are Open Source on Linux, which among other things means you won't need to spend money while learning. If you don't already have all the Windows tools be prepared to pay.

2. The GNU 'C' compiler on Linux is ANSI 'C' (ANSI is the American National Standards Institute). To work well with the entire Windows environment, Microsoft 'C' compilers are not 100% ANSI.

Thank you. I have since decided to follow the stickies at the top of this category to find either linux-specific, or OS-neutral, sources of information. Wish me luck--you all will probably hear from me as I [eventually] start to ask more programming-specific questions.