Re: separate compilation
- From: nullptr <ruben_lledo hotmail com>
- To: gtkmm-list gnome org
- Subject: Re: separate compilation
- Date: Fri, 23 Oct 2009 04:40:33 -0700 (PDT)
Sorry, I intended to write my former post using HTML by I forgot to break the
lines.
Hello.
My question is simple. Suppouse we've got three files: two containing the
code for the main window and its header file and another one containing the
main procedure. Our goal is to create the main window's object file and the
execuble file with a makefile this way:
GTKMM_INCLUDE=`pkg-config --cflags gtkmm-2.4`
GTKMM_LIB=`pkg-config --libs gtkmm-2.4`
main: main.cpp mainwindow.o
$(CXX) $(GTKMM_INCLUDE) $(GTKMM_LIB) $^ -o $@
mainwindow.o: mainwindow.cpp mainwindow.h
$(CXX) -c $(GTKMM_INCLUDE) $^ -o $@
Main windows's files are like these:
mainwindow.h
#include class MainWindow : public Gtk::Window
{
public:
MainWindow();
virtual ~MainWindow();
};
mainwindow.cpp
#include "mainwindow.h"
using namespace Gtk;
MainWindow::MainWindow() : public Window() { }
MainWindow::~MainWindow() { }
main.cpp
#include <gtkmm/main.h>
#include "mainwindow.h"
using namespace Gtk;
int main(int argc, char* argv[])
{
Main app(argc, argv);
MainWindow wnd;
app.run(wnd);
return 0;
}
Well, gcc v4.3.3 compiles correctly the main windows's files and creates the
corresponding object file but the linker complains. This is the error that
the linker reports:
mainwindow.o: file not recognized : File format not recognized
collect2: ld returned 1 exit status.
¿Why on earth such a simple example fails to compile?
Thanks in advance.
--
View this message in context: http://www.nabble.com/separate-compilation-tp26024677p26024770.html
Sent from the Gtkmm mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]