gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Beginner help - compiling and linking via command line

#146223 - darknut101 - Fri Nov 30, 2007 9:09 pm

im having trouble trying to compile and link a simple ds example program via command line. I have done some programming on the GBA using VHAM but I have never compiled a c++ program through command line. I'm following the NDS tutorial on dev-scene and Im at the step where I compile the hello world example that comes with devkitpro. Every time I try to compile it the command prompt tells me that 'make' is not recognized as a valid command. Is there something simple that I am missing? The makefile is present in the hello world program's directory. I have done a lot of searching through help pages and faqs and I cant find anything. Any help would be appreciated. Thanks.

#146229 - tepples - Fri Nov 30, 2007 10:20 pm

darknut101 wrote:
I'm following the NDS tutorial on dev-scene and Im at the step where I compile the hello world example that comes with devkitpro. Every time I try to compile it the command prompt tells me that 'make' is not recognized as a valid command. Is there something simple that I am missing?

Make is part of MSYS. Did you use devkitPro Updater to install MSYS?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#146230 - darknut101 - Fri Nov 30, 2007 10:28 pm

I'm not familiar with MSYS. I used the devkitpro updater 1.4.4 to install devkitpro if that helps. Where could I find MSYS and what exactly is it? Thanks a lot!

#146236 - zeruda - Fri Nov 30, 2007 11:33 pm

Go to your devkitpro folder. In there should be a folder called msys. In that folder run the msys.bat to bring up msys command line window. Type your make command in there and it should work.

#146263 - darknut101 - Sat Dec 01, 2007 5:24 pm

Thanks for the help. I opened up msys.bat and typed the make command but it told me there was no target specified and no makefile found. I am completely clueless when it comes to doing anything via command line. Thats why I wanted to read through this tutorial and learn how build a binary the hard way. The tutorial doesn't give me much info except just type make and it all should magically work. Can anybody fill me in on where I can learn more about building binaries via command line? Maybe a tutorial or something? I don't want to be asking questions on a forum all day like someone who cant help them self. Thanks again for all the help.

#146266 - yellowstar - Sat Dec 01, 2007 6:55 pm

The best way to do homebrew is with an
IDE, like Programmers Notepad.(Can be downloaded with the DKP updater)

Check the DevKitPRO website
for how to integrate it with your project.

I can post on how to do what you want,
but I'll do it later.
(The posting textbox got cleared when I was writing that post...)

#146277 - yellowstar - Sat Dec 01, 2007 10:10 pm

Here's how you use
bat files, in Windows:

(This is want you want.
Note that I wrote this in Win98.
The following may be differen't if you're using a differen't version.

You should be able to do similar things,
like the following, on a differen't OS,
but you'll have figure that out yourself.
Unless somebody else helps.)

Whenever I tried running make from
Start->Run, it never worked.
Instead,
I had to use bat files,
or an IDE.

In case you don't know what bat files are,
they are basicly files
which contain DOS code.
All you have to do to run them, is,
double click them.

By the way,
the reason why msys.bat didn't work
is because it wasn't in your project directory.
If you would navigate to your project directory,
it should have worked.(the command is cd,
at least for me.)

1. Open Notepad.

2. Type "make" and "pause",
on seperate lines.(Without the ")
(make before pause)
(If that pause wasn't there, you couldn't see the output.
That also means you couldn't check/fix errors.)

3.
Save it as build.bat,
in your project directory.(with the all *.* filter)

4.
Repeat the above steps again,(clear the textbox first)
but this time, type clean instead of make,
and save it as clean.

You're done!
When you want to compile,
just double-click build.bat.

However,
there is a faster,
and better,
way to create bat files for this.
(Which I use all the time
whenever I use bat files.)


Explorer's "Hide file extenstions for known file types"
option must be disabled.
(Explorer->Folder Options->View->above option = disable)

1. Create a text file in the project directory.

2. Rename it to the correct bat file.
Do build.bat and clean.bat(check the above steps)

3. Type the correct contents for each bat file.
(check above steps.)

You're done!
Now you can compile
by double-clicking the build.bat file.

#146471 - darknut101 - Tue Dec 04, 2007 5:18 pm

Thank you for all the help and the batch file primer. Your method seemed to work just fine. I know I could be using an IDE and it would make everything much easier but I just wanted to learn how to build executables the hard way via command line.