Need help in fixing a gcc error

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

 



Hi,

I am running gcc 4.2.3 on ubuntu.

I am getting the following error:


/home/yinglcs/TestGtkEmbed.cpp:290:
undefined reference to `A::setA(int a)'
TestGtkEmbed.o: In function `ob_sig_int':
/home/yinglcs/TestGtkEmbed.cpp:1172:
undefined reference to `A::getA()'

Where setA, GetA are static functions of class A.

And this is the command I have for compiling TestGtkEmbed.

c++   -fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith
-Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy
-Wno-non-virtual-dtor -Wcast-align -Wno-long-long -pedantic
-fno-strict-aliasing -fshort-wchar -pthread -pipe  -DDEBUG -D_DEBUG
-DDEBUG_yinglcs -DTRACING -g -fno-inline -Os -freorder-blocks
-fno-reorder-functions -I/usr/include/gtk-2.0
-I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/freetype2
-I/usr/include/libpng12 -I/usr/include/gtk-unix-print-2.0   -o
TestGtkEmbed TestGtkEmbed.o  -lpthread
-Wl,-rpath-link,../../../../dist/bin  -L../../../../dist/bin
-L../../../../dist/lib  -lX11   ../../../../dist/lib/libxpcomglue.a
-ldl -lm  -lgtk-x11-2.0 -latk-1.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm
-lpangocairo-1.0 -lfontconfig -lXext -lXrender -lXinerama -lXi
-lXrandr -lXcursor -lXcomposite -lXdamage -lpango-1.0 -lcairo
-lgmodule-2.0 -ldl -lX11 -lXfixes -lgobject-2.0 -lglib-2.0
-lgnet-2.0
TestGtkEmbed.o: In function `main':

I suspect that when I compile TestGtkEmbed, i am not linking against
A.o and that results in the 'undefined reference to `A::getA()'  that
i saw.
Is that right?

If yes, can you please tell me how to fix it?

If not, can you please tell me what is the cause of my problem?

Thank you.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux