Sign in to follow this  

Multiple file projects, anjuta, command line and Ubuntu.

This topic is 3846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!. Again, I've been away for a while from the forums lately due to lots of work and programming related studies. In the meantime I've finally cleaned up my computer (wich badly needed some cleansing!) and installed both a Windows and a Linux based system (Ubuntu). A couple of days ago I finished the first year of the course I'm doing and figured out that I could start "game programming" again. I've grown used to compiling from the command line in Ubuntu and neglected IDE's as a consequence of the course. The thing is that today I tried to start off again and found myself completely lost: started by installing Anjuta and recovering some project I had for DevC++ using the SDL library. Though I could install SDL just fine I just can't make my files compile thanks to "Makefile and objective doesn't exist". I figure out that I should get a hold of what makefiles are and how they relate to the Linux-based systems (I figure out that objective is just the... objective file). Searching the internet gave me many links about "how this application does the makefile for you" (Anjuta is supposed to :S) but no answers I could use... The "No makefile and objective" error pops up even when creating a default Anjuta project (still, it compiles without errors) so I have two questions here: what's this makefile thing and where I could learn about it?. Is something wrong with my Anjuta and do I need more packages?. Also, as said, I've grown use to gcc and g++ from the command line and sort of like it. Still, all things I've done with them were single file projects. Is there a manual out there on how to use it for projects with many files?. Thanks a lot in advance.

Share this post


Link to post
Share on other sites
You should definately look into using makefiles. I've got a good link that shows how to use them, but first I'll just describe what they do.

Say you want to compile a program Game. To be made, Game depends on all of the objects that need to be linked together. For instance, you need to link main.o, sound.o, graphics.o and all the other compiled objects not to mention various libraries you used. However, how can you link main.o, sound.o, and graphics.o? They don't exist yet! So, you then compile main.cpp, sound.cpp, and graphics.cpp to generate the object files.

Make keeps track of these depencies for you. All you need to do is tell it what depends on what in a makefile and whenever you wish to recompile, you run make in the local directory. And make can do a lot more things too, but for most simple projects the above is all that's needed.

For information on writing makefiles, read this. Hope that helps.

Share this post


Link to post
Share on other sites
First, thanks for the quick and helpful reply!!. I have just bookmarked the link you gave me and will start reading right now: I'm sure I will need to know about makefiles before even trying to start using Anjuta!. I guess IDE specific questions will come later. Thanks a lot :).

Share this post


Link to post
Share on other sites
Here's what Wikipedia has to say about makefiles.

As to why Anjuta doesn't work I have no idea. I used it several years ago, and if I remember correctly it should create a makefile for you when you create a new project. You can check the Anjuta documentation if you need help. Otherwise there's lots of other IDE's out there, like Code::Blocks or Eclipse with CDT (which I use).

Also, since you use Ubuntu, make sure that you install the dev-packages for the libraries you use. As an example you need to install the package sdl-dev if you want to compile programs that use SDL. And you also need to have the build-essential package, but it sounds like you already have that.

Share this post


Link to post
Share on other sites
Just finished giving the makefile links a first read and started to get a grip on things. So far I think I understand what makefiles are but still fail a bit on the variables and such... As for Anjuta, I think the problem lies on the project part (I can perfectly run single files but can't do it with single-file projects): the error it returns is just the console output for "make" without any parameters so I'm surely missing something... I read somewhere about "autotools" that should create the "makefiles" for me but according to Synaptics I already have them.

I guess I'll try looking around in Anjuta or switch to other Gnome-Compatible IDE (Code:Blocks looked familiar to me but got lost in the website :P).

As for the dev files, I luckily have them!. Looked around the forums a bit to find information about them (the packages on the Lazyfoo tutorials weren't valid for Ubuntu) and finally found the files on Synaptics without problems.

Edit: I think I got it. It seems that Anjuta depends a lot on the autotools. Looking for autotools in Synaptics revealed that I had them installed but either that's not the package that Anjuta needs or it needs a few others (automake, autolib and libtool?). Installing them solved the problems, showing a few warnings but well, I guess that's just its default behaviour.

Thanks a lot for your help!!!.

[Edited by - The_Marlboro_Man on June 6, 2007 12:35:19 PM]

Share this post


Link to post
Share on other sites

This topic is 3846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this