View Full Version : Problem with make

October 4th, 2005, 04:21 PM
I'm rather new to make files. I was following the tutorial for CDT but I keep running into this error. Any idea how to fix this?

Ok i fixed the error. But there is no main.exe created.

October 4th, 2005, 04:53 PM
Firstly remove hello.exe from the rm statement.

Add the -f flag to rm as this way rm doesn't complain if the file isn't there.

Remove the makefile: from the top of the file.

Then try

October 4th, 2005, 04:57 PM
edit the main.o rule so it look like

main.o: main.cpp
g++ -c -g main.cpp

There are generic build rules, but start with this.

Also the tutorials on the gnu site for make a quite good.

October 4th, 2005, 04:59 PM
No dice mate. Still no main.exe file generated.

David Marrs
October 4th, 2005, 05:04 PM
The file generated is called "hello". You run it by typing './hello' at the terminal. If you want it to be called main.exe you'll have to change the line:

hello: main.o


main.exe: main.o

October 4th, 2005, 05:13 PM
Ah I see. I shall try that. Just out of curiosity. Is what make is doing similar to what the Ant build files do?

Ok now I manage to run the ant file but it gives me some other errors. I think its got to do with my using the namespace.

/usr/include/c++/3.3/bits/basic_string.tcc:731: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string[in-charge]()'

Any idea?

October 4th, 2005, 06:12 PM
I've figured out whats wrong. Silly mistake. Should have used g++ insteaed of gcc.

Thanks thumper and David for the help.