A common GCC error!

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Locked
KernelX
Posts: 7
Joined: Wed Feb 15, 2012 9:48 am

A common GCC error!

Post by KernelX »

I used to compile my C codes using gcc.exe ,I get an error as "envoirmental variable DJGPP undefined".I am a new OSdevelopment , what is the solution for that.

Please I had been reading a Brans Kernel Development Tutorial just to learn and I wished to compile the kernel and this error spoilt my happiness of compiling and boot.

wiki.osdev.org is awsom.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: A common GCC error!

Post by AJ »

Hi,

The DJGPP download page has the required info for setting the DJGPP environment variable for a short-term fix (or it did when I last used DJGPP 5 years ago!).

The better long term solution, though, is to use a GCC Cross-Compiler. If you follow that tutorial and get any errors, it has become a sort of "standard" on OSDev.org and you'll find there are many more people who can help you to find solutions.

Cheers and welcome,
Adam

[edit: Yup - just had a quick look at the DJGPP zip picker and the installation info is still a part of the download. Be warned though - you will get less helpful support from the OSDev community if you continue with DJGPP...]
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: A common GCC error!

Post by AJ »

For anyone following this thread, OP also posted in http://forum.osdev.org/viewtopic.php?f=1&t=1753 which is now locked.
KernelX
Posts: 7
Joined: Wed Feb 15, 2012 9:48 am

Solution!!!

Post by KernelX »

SET DJGPP=c:/wherever you put djgpp/djgpp.env
Put the above line in your autoexec.bat. If you still get the error message, check if you have installed all neccessary DJGPP packages.

This was the solution written by uri.

autoexec.bat (Under Windows) is located on the drive where you have installed WINDOWS.Also note that it is a hidden operating system file and must be careful while editing it.You can open it by typing the following in the run."C:\autoexec.bat"
Replace 'C:\' with your drive containing WINDOWS.
More information visit: http://en.wikipedia.org/wiki/AUTOEXEC.BAT

To fix the error follow these steps:
Open autoexec.bat in notepad and copy the code below to it.
SET DJGPP=c:/wherever you put djgpp/djgpp.env

NOTE:Dont forget to to set the location where you have installed djgpp.(Look at the code up once)

If you get Ascess is denied ,do the following:
1)Save the autoexec.bat somewhere else.(Keep the extension as bat)
2)Copy and paste it on the drive were WINDOWS is installed.
3)It has to copy.

I have tested it!
Good Luck!
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: A common GCC error!

Post by VolTeK »

..What? This is neither an Os design, or theory. Any announcement should be put in the forum stated.


Also, please start them out a little better, do not just jump halfway into the subject. The title barely tells us what it is your presenting as it is.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: A common GCC error!

Post by AJ »

...and what version of Windows are you using if you still have autoexec.bat? That's not the way to set up environment variables in anything beyond about the Win9x series.

To avoid future issues, please use the cross-compiler.

Cheers,
Adam
Locked