M
Martin York
I am trying to compile the program from this page:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-helloworld...
I use this makefile:
all: main
main: helloworld.h helloworld.cc main.cc
g++ main.cc -o main `pkg-config gtkmm-2.4 --cflags --libs`
But when I compile I get:
/tmp/ccPWqvDE.o: In function `main':
main.cc.text+0x37): undefined reference to `HelloWorld::HelloWorld()'
main.cc.text+0x54): undefined reference to `HelloWorld::~HelloWorld()'
main.cc.text+0x67): undefined reference to `HelloWorld::~HelloWorld()'
collect2: ld returned 1 exit status
make: *** [main] Error 1
But I don't understand why since the constructors are specified.
This is not a problem with your code but a problem with what you are
building.
Your code is in two files main.cc and helloworld.cc but you are only
building main.cpp
You should probably drop a note to a group that can help you get your
makefile set up correctly. As a temporary solution change the build
line to:
g++ main.cc helloworld.cc -o main `pkg-config gtkmm-2.4 --
cflags --libs`
Notice: ^^^^^^^^^^^^