Getting new Compilers (C/C++)

Programming, for all ages and all languages.
REV

Getting new Compilers (C/C++)

Post by REV »

I've had it with Watcom and all of its crap. Ive also had it with JLOC and all of its crap.

I was looking at GCC and it looks like a good deal with all of its architectures and a other tools like LD and such.

Im running Windows 2000 *Heart* and Windows NT and I looked at MinGW and Cygwin. The FAQ reccommended against MinGW.

I want a compiler I can just throw onto my HD and command line compile quickly after installing.

Any suggestions?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Getting new Compilers (C/C++)

Post by Candy »

For getting into different trouble, download a binary of something and use it.

For solving your trouble, do what the FAQ says and use either cygwin or mingw to compile a crosscompiler (see cross-compiler).
REV

Re:Getting new Compilers (C/C++)

Post by REV »

Great looks like I have to spend another 3 ****ing weeks wasting my time. ****ing hell I've been trying to get a basic kernel working for almost 6 months now. This is just ****ing great.

Why would I need to build a cross compiler though?
bluecode

Re:Getting new Compilers (C/C++)

Post by bluecode »

REV wrote:Why would I need to build a cross compiler though?
Might be surprising, but it's because you don't use Linux. It's just way better for out of the box os development. The other reasons are mentioned in the OSFAQ. Just have a look.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Getting new Compilers (C/C++)

Post by Pype.Clicker »

REV wrote: Why would I need to build a cross compiler though?
1. keep your **** words on your **** side of the connection, right.
2. As you might have noticed, the FAQ is about OS deving. There are good reasons to build a cross-compiler for OS deving, and especially under windows.
3. If you don't intend to do OS deving, but programming over the Win32 API, you could very well use MingW, or a native cygwin binary.
REV

Re:Getting new Compilers (C/C++)

Post by REV »

Alright,
Right now I want to compile to a plain binary for simplicity. Also I want the target platforms to be entire IA32 platforms (i386, i486, etc...).

Is this possible for GCC looking at the cross compiler tutorial?
Midas
Member
Member
Posts: 140
Joined: Sat Jun 24, 2006 4:40 pm
Location: Falkirk, Scotland
Contact:

Re:Getting new Compilers (C/C++)

Post by Midas »

For compiling and linking to a flat binary, this is possible with GCC, simply because I've seen other people do it. I personally haven't and therefore can't even start to tell you how - but I'm sure it's no more complex than setting it up to compile to any other target binary.

As for target platforms, that's easy. Following the walkthrough in the FAQ exactly, assuming nobody's changed it, with result in you having a compiler targetting i586-ELF (which you may well want to change). You can change it to target other platforms easily enough.
Regards,
Angus [Óengus] 'Midas' Lepper
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Getting new Compilers (C/C++)

Post by Pype.Clicker »

there are probably things that might be disabled in a specific distro, but
1. producing a flat binary is typically achieved by the linker. Study the output of "ld --help" on your distro to see whether it has output format "binary" supported or not.
2. you can tell gcc to compile code for a specific sub-architecture with -march=<cputype> or -mtune=<cputype>, look for "Intel 386 and AMD x86-64 options" in "info gcc"
REV

Re:Getting new Compilers (C/C++)

Post by REV »

Well thank you. Old Watcom could never do that.
What about other Architectures like Alpha, M68K, PowerPC and such?
REV

Re:Getting new Compilers (C/C++)

Post by REV »

Well im compiling my cross compiler now. I changed all the i586s to i386s.

Are there any enviroment varibles I can use?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Getting new Compilers (C/C++)

Post by Solar »

For what?

(Quality of response is directly proportional to quality of question...)
Every good solution is obvious once you've found it.
REV

Re:Getting new Compilers (C/C++)

Post by REV »

Include directories and stuff like that.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Getting new Compilers (C/C++)

Post by Solar »

For environment variables, try chapter 3.19 Environment variables affecting GCC of the GCC manual. For include directories, try chapter 3.14 Options for Directory Search. I don't know about "stuff like that", but you might want to generally RTFM.
Every good solution is obvious once you've found it.
REV

Re:Getting new Compilers (C/C++)

Post by REV »

Are these for Windows? Im building my OS through a batch file.
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Re:Getting new Compilers (C/C++)

Post by Kevin McGuire »

@REV:
I assume the goal you have is to write a operating system by the amount of work you do in asking questions. That is a great attitude to have towards goals. It shows you have an amount of motivation, and inspiration for your own personal reason.

If the personal reason is to have something that can provide you with recognition, then this is very easy to attain simply by taking someone elses kernel and showing to your friends, and saying I wrote that thus telling a lie. Forget that telling a lie is wrong and blah blah blah, but it lets you attain the goal you want. So who would not do this is their goal was to gain recognition for writting a operating system?

However, if that makes you feel bad, is not the reason, is only a fraction of the reason, or not of the reason then you must understand that my assumption here at the end of this message is based on your questions. The assumption is:

"
This guy needs to learn a *whole lot more* then just how to cross-compile GCC for writting a operating system. Now, he should not give up trying to write a operating system, but understand that the amount of information he needs is too great for asking questions in a forum. REV, should instead try to read *all* the links that Solar posted even if he can barely read english. If he got far enough to download a compiler and learn some C/C++ then something is going to stick everytime he reads those links.
"

WHAT HAPPENS AFTER YOU READ THOSE LINKS?
You will actually increase the amount of information in your brain directly relating to an increase in intellegence in dealing with the opposite sex, and this increase in information is can also be called excersing the brain and eyes - since you know over 3/4 of the conversation with the opposite sex is body language so reading will actually increase the connectivity between your eyes and brain allowing faster and more accurate deciphering of complex mental and visual clues to the world around you. :P
Post Reply