Re: separate compilation



Dear nullptr,

I had to remove a few errors that you introduced while copying your files to the email, but then I saw the same behaviour and the same error message "mainwindow.o: file not recognized : File format not recognized". I don't see what the error message has to do with it, but the solution is this:

mainwindow.o: mainwindow.cpp mainwindow.h
  $(CXX) -c $(GTKMM_INCLUDE) $^ -o $@

According to the g++ manual page -c and -o are exclusive. -c means do not link but create an object file for every input, while -o means create an output file of specified name. The following is correct:

mainwindow.o: mainwindow.cpp mainwindow.h
	$(CXX) $(GTKMM_INCLUDE) -c mainwindow.cpp

And I also recommend switching on warnings in your compiler.

All the best,
Mark


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]