By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 833 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Reducing complexity for starting a project

P: n/a
After spending a lot of time writing code in other languages,
returning to C++ and starting a new project has been painful. It seems
in order to get anything done you need to #include, add linker
parameters, create a makefile, and update that makefile everytime you
add new files. I realize that _sometimes_ you want to #include a
header but potentially link against different object files, but for me
and I think most people making desktop applications that's pretty
rare. What I'd like to do is something like:

#include <SDL/sdl.h>

And my linker flags would be automatically updated to link SDL.
Additionally, my project would be a single folder, and any *.cpp files
I had inside or in subfolders would just get compiled when I typed
"make," without me having to write any sort of "Makefile" whatsoever.
I don't need anymore flexibility in my build system. I just want
linker flags to be inferred and for my makefile to automatically
update for new files, without having to commit to a bloated IDE (I
like emacs).

Are there any tools like this?

Thanks

Joe

Jun 9 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
dataangel wrote:
After spending a lot of time writing code in other languages,
returning to C++ and starting a new project has been painful. It seems
in order to get anything done you need to #include, add linker
parameters, create a makefile, and update that makefile everytime you
add new files. I realize that _sometimes_ you want to #include a
header but potentially link against different object files, but for me
and I think most people making desktop applications that's pretty
rare. What I'd like to do is something like:

#include <SDL/sdl.h>

And my linker flags would be automatically updated to link SDL.
Additionally, my project would be a single folder, and any *.cpp files
I had inside or in subfolders would just get compiled when I typed
"make," without me having to write any sort of "Makefile" whatsoever.
I don't need anymore flexibility in my build system. I just want
linker flags to be inferred and for my makefile to automatically
update for new files, without having to commit to a bloated IDE (I
like emacs).
You only have to set these things up once, probably in less time that it
took to compose this message! That's the purpose of tools like Make and
Ant.

--
Ian Collins.
Jun 9 '07 #2

P: n/a
It's still a pain over other languages, and I'm still going to have to
update the Makefile every time I decide to split code into another
file, which happens a lot at the beginning of a project. We're
programmers, we're lazy and like efficient solutions ;)

On Jun 9, 7:48 pm, Ian Collins <ian-n...@hotmail.comwrote:
dataangel wrote:
After spending a lot of time writing code in other languages,
returning to C++ and starting a new project has been painful. It seems
in order to get anything done you need to #include, add linker
parameters, create a makefile, and update that makefile everytime you
add new files. I realize that _sometimes_ you want to #include a
header but potentially link against different object files, but for me
and I think most people making desktop applications that's pretty
rare. What I'd like to do is something like:
#include <SDL/sdl.h>
And my linker flags would be automatically updated to link SDL.
Additionally, my project would be a single folder, and any *.cpp files
I had inside or in subfolders would just get compiled when I typed
"make," without me having to write any sort of "Makefile" whatsoever.
I don't need anymore flexibility in my build system. I just want
linker flags to be inferred and for my makefile to automatically
update for new files, without having to commit to a bloated IDE (I
like emacs).

You only have to set these things up once, probably in less time that it
took to compose this message! That's the purpose of tools like Make and
Ant.

--
Ian Collins.

Jun 9 '07 #3

P: n/a
dataangel wrote:

Please don't top-post...
On Jun 9, 7:48 pm, Ian Collins <ian-n...@hotmail.comwrote:
>dataangel wrote:
>>After spending a lot of time writing code in other languages,
returning to C++ and starting a new project has been painful. It seems
in order to get anything done you need to #include, add linker
parameters, create a makefile, and update that makefile everytime you
add new files. I realize that _sometimes_ you want to #include a
header but potentially link against different object files, but for me
and I think most people making desktop applications that's pretty
rare. What I'd like to do is something like:
#include <SDL/sdl.h>
And my linker flags would be automatically updated to link SDL.
Additionally, my project would be a single folder, and any *.cpp files
I had inside or in subfolders would just get compiled when I typed
"make," without me having to write any sort of "Makefile" whatsoever.
I don't need anymore flexibility in my build system. I just want
linker flags to be inferred and for my makefile to automatically
update for new files, without having to commit to a bloated IDE (I
like emacs).
You only have to set these things up once, probably in less time that it
took to compose this message! That's the purpose of tools like Make and
Ant.
It's still a pain over other languages, and I'm still going to have to
update the Makefile every time I decide to split code into another
file, which happens a lot at the beginning of a project. We're
programmers, we're lazy and like efficient solutions ;)
That's why they give us IDEs...

Joking aside, refactoring a makefile or build script is just part of the
development process. It's the price we pay for flexibility and the lack
of dependence on an interpreter/VM the knows where to find things.

--
Ian Collins.
Jun 10 '07 #4

P: n/a
dataangel wrote:
....
Are there any tools like this?
MakeXS does somthing like this but it's not perfect.

At the moment MakeXS uses GNU make and m4. The idea behind MakeXS is
that simply putting a .cpp file in an appropriate directory will make
the Right™ things happen.

It also automatically works our the root of the tree, the include
directories, libs etc etc. You can go to any directory and type "make"
and everything in that folder and below is built. It supports "release"
and "debug" (work) builds - bulding of unit tests, running of unit
tests, 64 bit vs 32 bit builds, doxygen builds and easily allows
environment variable overrides or even developer specific configuration.

The latest version can be found with the Austria C++ "alpha".
http://netcabletv.org/public_releases/

I don't know how well other tools like cmake, Jam etc work. I used
cmake on one project and I was not totally happy with its win32 support.
Although MakeXS requires cygwin so it's not much better.

The learning curve is steep but short.
Jun 10 '07 #5

P: n/a
Ian Collins wrote:
....
Joking aside, refactoring a makefile or build script is just part of the
development process. It's the price we pay for flexibility and the lack
of dependence on an interpreter/VM the knows where to find things.
make is the assembler of build tools. you can build an awful lot on top
of make that reduces the maintenance of trivial things like the OP is
alluding to.

MakeXS does alot with GNU make but much more can be done to eliminate
virtually all trivial work.
Jun 10 '07 #6

P: n/a
dataangel wrote:
After spending a lot of time writing code in other languages,
returning to C++ and starting a new project has been painful. It seems
in order to get anything done you need to #include, add linker
parameters, create a makefile, and update that makefile everytime you
add new files. I realize that _sometimes_ you want to #include a
header but potentially link against different object files, but for me
and I think most people making desktop applications that's pretty
rare. What I'd like to do is something like:

#include <SDL/sdl.h>

And my linker flags would be automatically updated to link SDL.
Additionally, my project would be a single folder, and any *.cpp files
I had inside or in subfolders would just get compiled when I typed
"make," without me having to write any sort of "Makefile" whatsoever.
I don't need anymore flexibility in my build system. I just want
linker flags to be inferred and for my makefile to automatically
update for new files, without having to commit to a bloated IDE (I
like emacs).

Are there any tools like this?
What you can do, at least for the cpp-stuff, is to direct your Makefile
to use *any* cpp files inside your source-tree:

CPPs = $(shell find . -name \*.cpp)

Yours,
Daniel

--
Got two Dear-Daniel-Instant Messages
by MSN, associate ICQ with stress --
so please use good, old E-MAIL!
Jun 10 '07 #7

P: n/a
On 2007-06-10 11:25, Daniel Kraft wrote:
dataangel wrote:
>After spending a lot of time writing code in other languages,
returning to C++ and starting a new project has been painful. It seems
in order to get anything done you need to #include, add linker
parameters, create a makefile, and update that makefile everytime you
add new files. I realize that _sometimes_ you want to #include a
header but potentially link against different object files, but for me
and I think most people making desktop applications that's pretty
rare. What I'd like to do is something like:

#include <SDL/sdl.h>

And my linker flags would be automatically updated to link SDL.
Additionally, my project would be a single folder, and any *.cpp files
I had inside or in subfolders would just get compiled when I typed
"make," without me having to write any sort of "Makefile" whatsoever.
I don't need anymore flexibility in my build system. I just want
linker flags to be inferred and for my makefile to automatically
update for new files, without having to commit to a bloated IDE (I
like emacs).

Are there any tools like this?

What you can do, at least for the cpp-stuff, is to direct your Makefile
to use *any* cpp files inside your source-tree:

CPPs = $(shell find . -name \*.cpp)
For smaller projects a makefile might not even be necessary, just doing
'g++ -o myapp *.cpp' might work. And as others have pointed out, if you
use an IDE there might be tools to automatically build the program for
you, either by generating a makefile or by not using one at all.

--
Erik Wikström
Jun 10 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.