On 25 June 2012 15:23, blessman11 wrote: > > > > Jonathan Wakely-4 wrote: >> >> On 21 June 2012 16:14, blessman11 wrote: >>> >>> hi >>> >>> I'm trying to code hello world in GCC, but whilst I get my simple >>> makefile >>> correctly, the problem comes when I try to use <iostream> or even my own >>> headerfiles defined outside the folder with my main .cpp file. >>> >>> so any help? >> >> I already answered this question, read my entire reply: >> >> http://gcc.gnu.org/ml/libstdc++/2012-06/msg00068.html >> >> > > I thought I had been posting in this thread instead, my bad. But why is it > throwing up errors like that, how can I make my code stop linking with "gcc" > instead of "g++". What else do I have to do beyond what I did? > > [output]all: hello > -std=c++11 > > objects = hello.o > > edit: $(objects) > g++ -o edit $(objects) > [/output] You haven't defined a rule for building "hello" so it uses the implicit rule to link "hello.o" into hello, which is: $(CC) $(LDFLAGS) hello.o $(LOADLIBES) $(LDLIBS) -o hello CC is the C compiler, not the C++ compiler, so it doesn't link the C++ runtime libraries. Your makefile has a rule to build "edit" but you seem to want a target called "hello" -- why is your rule building "edit" instead? It will work if you just change "edit" to "hello" or vice versa. Also, your rule for "all" is invalid, "-std=c++0x" is not a valid rule, I don't know what you meant that to be.