The gcc compiler on openSUSE is hardwired to generate x86/x86_64 code. You need to build a separate gcc that will generate mips code. This is known as a cross-compiler. And not just the gcc, but all the other tools in the compiler chain, i.e. as, ld, nm, and so forth.
I am not used to with cross compiling. Can you please show me some way to start with… like raw list of things to start with. I do not want to mess my current installation, and if possible i want to create a separate compiler for mips.
I found cross-mips-binutils package, but it is not same as cross-mips-gcc, right?
since iam very very new to programming, and most of the time i use some IDE(eclipse, netbeans) I do not know much about ld, as and other tools, Perhaps some links suse specific guide would help me much.
You’ll have to make it separate, if you don’t want to mess up your system. Go to the gcc site for all the details. Basically it’s the same as compiling any other program, you take the gcc sources and run ./configure, specifying the generated language as MIPS assembly. And then you do the same for the as, you configure it to accept MIPS assembly. And for ld, to accept MIPS object format. And to actually be able to build an executable program you need to build some MIPS runtime libraries for libc at least. And of course, you need a real MIPS machine to run the program. And all the executable programs have to be kept separate from the system ones.
Expect to spend many minutes or a few hours, depending on the speed of your system to compile everything needed.
Writing the program can be done with any editor or IDE since the code is still C. After all, C is a machine independent system programming language.