ArchiveOrangemail archive

vtkusers.vtk.org


(List home) (Recent threads) (1 other Visualization Toolkit (VTK) lists)

Subscription Options

  • RSS or Atom: Read-only subscription using a browser or aggregator. This is the recommended way if you don't need to send messages to the list. You can learn more about feed syndication and clients here.
  • Conventional: All messages are delivered to your mail address, and you can reply. To subscribe, send an email to the list's subscribe address with "subscribe" in the subject line, or visit the list's homepage here.
  • Moderate traffic list: up to 30 messages per day
  • This list contains about 85,480 messages, beginning Mar 1999
  • 4 messages added yesterday
Report the Spam
This button sends a spam report to the moderator. Please use it sparingly. For other removal requests, read this.
Are you sure? yes no

'Undefined Reference' Error Message

Ad
Jeremy Stout 1098268079Wed, 20 Oct 2004 10:27:59 +0000 (UTC)
Hello, I am trying to compile a VTK program with the following line:

g++ translator.cpp -otranslator -I/usr/local/include/vtk
-I/usr/local/packages/mpich/include -L /usr/local/
lib/vtk/ -lvtkParallel  -L /usr/local/packages/mpich/lib -lmpich -ldl

Unfortunately, this results in the following error messages:

In file included from /usr/include/c++/3.3.3/backward/strstream:51,
                 from /usr/local/include/vtk/vtkIOStream.h:36,
                 from /usr/local/include/vtk/vtkSystemIncludes.h:40,
                 from /usr/local/include/vtk/vtkIndent.h:24,
                 from /usr/local/include/vtk/vtkObjectBase.h:43,
                 from /usr/local/include/vtk/vtkObject.h:41,
                 from /usr/local/include/vtk/vtkMultiProcessController.h:40,
                 from /usr/local/include/vtk/vtkMPIController.h:43,
                 from translator.cpp:2:
/usr/include/c++/3.3.3/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in section
17.4.1.2 of the C++ standard. Examples include substituting the <X>
header for the <X.h> header for C++ includes, or <sstream> instead of
the deprecated header <strstream.h>. To disable this warning use
-Wno-deprecated.
/tmp/ccZVONeC.o(.text+0x11): In function `main':
: undefined reference to `vtkMPIController::New()'
/tmp/ccZVONeC.o(.text+0x36): In function `main':
: undefined reference to `vtkConeSource::New()'

The code for the program can be seen here:
#include "vtkMPIController.h"
#include "vtkConeSource.h"
#include "mpi.h"

using namespace std;

main(int argc, char* argv[])
        {
        vtkMPIController *controller;
        bool okToContinue;
        int numberOfProcesses;
        int myProcessID;

        controller = vtkMPIController::New();
        controller->Initialize(&argc, &argv);
        
        //Testing the Linker here
        vtkConeSource *test;
        test = vtkConeSource::New();
        
        numberOfProcesses = controller->GetNumberOfProcesses();
        myProcessID = controller->GetLocalProcessId();
        
        controller->Finalize();
        controller->Delete();
        }

I've tried several variations on linking options, including linking in
all of the vtk libraries.  If anyone could provide some assistance in
this matter, it would be greatly appreciated.

Jeremy Stout
Jeremy Stout 1098285446Wed, 20 Oct 2004 15:17:26 +0000 (UTC)
Even when I use this command:

g++ translator.cpp -otranslator -I/usr/local/include/vtk
-I/usr/local/packages/mpich/include -L/usr/local/lib/vtk/ -lvtkCommon
-lvtkDICOMParser -lvtkParallel -lvtkIO -lvtkGraphics -lvtkFiltering
-lvtkHybrid -lvtkImaging -lvtkRendering -lvtkexpat -lvtkfreetype
-lvtkftgl -lvtkjpeg -lvtkpng -lvt
ktiff -lvtkzlib -L/usr/local/packages/mpich/lib -lmpich -ldl

I get:

/tmp/ccPx6BGK.o(.text+0x11): In function `main':
: undefined reference to `vtkMPIController::New()'
/tmp/ccPx6BGK.o(.text+0x36): In function `main':
: undefined reference to `vtkConeSource::New()'
collect2: ld returned 1 exit status

I have no idea what is causing the error and I can't continue work on
my program until I fix this. Thank you for your prompt response
though.

Jeremy StoutOn Wed, 20 Oct 2004 14:19:32 -0400, tom fogal  wrote:
> Jeremy Stout writes:
> >Hello, I am trying to compile a VTK program with the following line:
> >
> >g++ translator.cpp -otranslator -I/usr/local/include/vtk
> >-I/usr/local/packages/mpich/include -L /usr/local/
> >lib/vtk/ -lvtkParallel  -L /usr/local/packages/mpich/lib -lmpich -ldl
> 
> This is valid? I guess you learn something new everyday. I had always
> though you could not have a space between -L and its argument, but you
> seem to be using it and not getting link errors due to mpich...
> 
> >Unfortunately, this results in the following error messages:
> 
> <snip>
> 
> >/tmp/ccZVONeC.o(.text+0x11): In function `main':
> >: undefined reference to `vtkMPIController::New()'
> >/tmp/ccZVONeC.o(.text+0x36): In function `main':
> >: undefined reference to `vtkConeSource::New()'
> 
> You're forgetting to link in a library, my guess is vtkCommon. add in
> '-lvtkCommon' to your link line and see if that fixes it. I wouldve
> thought vtkMPIController would be in vtkParallel though...
> 
> HTH,
> 
> -tom
>
Mathieu Malaterre 1098287821Wed, 20 Oct 2004 15:57:01 +0000 (UTC)
Jeremy,

	What is the output of:

nm libvtkParallel.so| c++filt| grep vtkMPIController::New
and
nm libvtkGraphics.so| c++filt| grep vtkConeSource::New

I get:

0016d0b6 T vtkMPIController::New()
0016ea3c W vtkMPIController::NewInstanceInternal() const

and

000c821e T vtkConeSource::New()
000c9604 W vtkConeSource::NewInstanceInternal() const

If you don't get anything, that mean you didn't build VTK properly, turn 
MPI on for example

HTH
MathieuJeremy Stout wrote:
> Even when I use this command:
> 
> g++ translator.cpp -otranslator -I/usr/local/include/vtk
> -I/usr/local/packages/mpich/include -L/usr/local/lib/vtk/ -lvtkCommon
> -lvtkDICOMParser -lvtkParallel -lvtkIO -lvtkGraphics -lvtkFiltering
> -lvtkHybrid -lvtkImaging -lvtkRendering -lvtkexpat -lvtkfreetype
> -lvtkftgl -lvtkjpeg -lvtkpng -lvt
> ktiff -lvtkzlib -L/usr/local/packages/mpich/lib -lmpich -ldl
> 
> I get:
> 
> /tmp/ccPx6BGK.o(.text+0x11): In function `main':
> : undefined reference to `vtkMPIController::New()'
> /tmp/ccPx6BGK.o(.text+0x36): In function `main':
> : undefined reference to `vtkConeSource::New()'
> collect2: ld returned 1 exit status
> 
> I have no idea what is causing the error and I can't continue work on
> my program until I fix this. Thank you for your prompt response
> though.
> 
> Jeremy Stout
> 
> On Wed, 20 Oct 2004 14:19:32 -0400, tom fogal  wrote:
> 
>><a6bc6cc04102007277b92dab4@mail.gmail.com>Jeremy Stout writes:
>>
>>>Hello, I am trying to compile a VTK program with the following line:
>>>
>>>g++ translator.cpp -otranslator -I/usr/local/include/vtk
>>>-I/usr/local/packages/mpich/include -L /usr/local/
>>>lib/vtk/ -lvtkParallel  -L /usr/local/packages/mpich/lib -lmpich -ldl
>>
>>This is valid? I guess you learn something new everyday. I had always
>>though you could not have a space between -L and its argument, but you
>>seem to be using it and not getting link errors due to mpich...
>>
>>
>>>Unfortunately, this results in the following error messages:
>>
>><snip>
>>
>>>/tmp/ccZVONeC.o(.text+0x11): In function `main':
>>>: undefined reference to `vtkMPIController::New()'
>>>/tmp/ccZVONeC.o(.text+0x36): In function `main':
>>>: undefined reference to `vtkConeSource::New()'
>>
>>You're forgetting to link in a library, my guess is vtkCommon. add in
>>'-lvtkCommon' to your link line and see if that fixes it. I wouldve
>>thought vtkMPIController would be in vtkParallel though...
>>
>>HTH,
>>
>>-tom
>>
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
Jeremy Stout 1098288791Wed, 20 Oct 2004 16:13:11 +0000 (UTC)
If I use those commands, here is what I get:

[stout@energy stout]$ cd /usr/local/lib/vtk
[stout@energy vtk]$ nm libvtkParallel.so| c++filt| grep vtkMPIController::New
0016db2c W vtkMPIController::NewInstanceInternal(void) const
0016db50 W vtkMPIController::NewInstance(void) const
00107000 T vtkMPIController::New(void)
[stout@energy vtk]$ nm libvtkGraphics.so| c++filt| grep vtkConeSource::New
001dcb34 W vtkConeSource::NewInstanceInternal(void) const
001dcb58 W vtkConeSource::NewInstance(void) const
000d5df0 T vtkConeSource::New(void)

It has been about a month since I compiled VTK, but I believe I
included MPI support.

Jeremy StoutOn Wed, 20 Oct 2004 15:29:27 -0400, Mathieu Malaterre
 wrote:
> Jeremy,
> 
>        What is the output of:
> 
> nm libvtkParallel.so| c++filt| grep vtkMPIController::New
> and
> nm libvtkGraphics.so| c++filt| grep vtkConeSource::New
> 
> I get:
> 
> 0016d0b6 T vtkMPIController::New()
> 0016ea3c W vtkMPIController::NewInstanceInternal() const
> 
> and
> 
> 000c821e T vtkConeSource::New()
> 000c9604 W vtkConeSource::NewInstanceInternal() const
> 
> If you don't get anything, that mean you didn't build VTK properly, turn
> MPI on for example
> 
> HTH
> Mathieu
> 
> 
> 
> 
> Jeremy Stout wrote:
> > Even when I use this command:
> >
> > g++ translator.cpp -otranslator -I/usr/local/include/vtk
> > -I/usr/local/packages/mpich/include -L/usr/local/lib/vtk/ -lvtkCommon
> > -lvtkDICOMParser -lvtkParallel -lvtkIO -lvtkGraphics -lvtkFiltering
> > -lvtkHybrid -lvtkImaging -lvtkRendering -lvtkexpat -lvtkfreetype
> > -lvtkftgl -lvtkjpeg -lvtkpng -lvt
> > ktiff -lvtkzlib -L/usr/local/packages/mpich/lib -lmpich -ldl
> >
> > I get:
> >
> > /tmp/ccPx6BGK.o(.text+0x11): In function `main':
> > : undefined reference to `vtkMPIController::New()'
> > /tmp/ccPx6BGK.o(.text+0x36): In function `main':
> > : undefined reference to `vtkConeSource::New()'
> > collect2: ld returned 1 exit status
> >
> > I have no idea what is causing the error and I can't continue work on
> > my program until I fix this. Thank you for your prompt response
> > though.
> >
> > Jeremy Stout
> >
> > On Wed, 20 Oct 2004 14:19:32 -0400, tom fogal  wrote:
> >
> >><a6bc6cc04102007277b92dab4@mail.gmail.com>Jeremy Stout writes:
> >>
> >>>Hello, I am trying to compile a VTK program with the following line:
> >>>
> >>>g++ translator.cpp -otranslator -I/usr/local/include/vtk
> >>>-I/usr/local/packages/mpich/include -L /usr/local/
> >>>lib/vtk/ -lvtkParallel  -L /usr/local/packages/mpich/lib -lmpich -ldl
> >>
> >>This is valid? I guess you learn something new everyday. I had always
> >>though you could not have a space between -L and its argument, but you
> >>seem to be using it and not getting link errors due to mpich...
> >>
> >>
> >>>Unfortunately, this results in the following error messages:
> >>
> >><snip>
> >>
> >>>/tmp/ccZVONeC.o(.text+0x11): In function `main':
> >>>: undefined reference to `vtkMPIController::New()'
> >>>/tmp/ccZVONeC.o(.text+0x36): In function `main':
> >>>: undefined reference to `vtkConeSource::New()'
> >>
> >>You're forgetting to link in a library, my guess is vtkCommon. add in
> >>'-lvtkCommon' to your link line and see if that fixes it. I wouldve
> >>thought vtkMPIController would be in vtkParallel though...
> >>
> >>HTH,
> >>
> >>-tom
> >>
> > 
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> 
>
Brad King 1098290023Wed, 20 Oct 2004 16:33:43 +0000 (UTC)
Jeremy Stout wrote:

> If I use those commands, here is what I get:
> 
> [stout@energy stout]$ cd /usr/local/lib/vtk
> [stout@energy vtk]$ nm libvtkParallel.so| c++filt| grep vtkMPIController::New
> 0016db2c W vtkMPIController::NewInstanceInternal(void) const
> 0016db50 W vtkMPIController::NewInstance(void) const
> 00107000 T vtkMPIController::New(void)
> [stout@energy vtk]$ nm libvtkGraphics.so| c++filt| grep vtkConeSource::New
> 001dcb34 W vtkConeSource::NewInstanceInternal(void) const
> 001dcb58 W vtkConeSource::NewInstance(void) const
> 000d5df0 T vtkConeSource::New(void)
> 
> It has been about a month since I compiled VTK, but I believe I
> included MPI support.Are you using the same version of GCC to build your program that you did 
to build VTK?  C++ is not link-compatible across compilers or even 
compiler versions (at least until the multi-vendor standard is widely 
accepted).

-Brad
Jeremy Stout 1098352226Thu, 21 Oct 2004 09:50:26 +0000 (UTC)
It seems that the system administrator upgraded gcc between when I
compiled vtk and now. I'll recompile vtk and see if that works. Thank
you for the suggestion.

Jeremy StoutOn Wed, 20 Oct 2004 16:32:33 -0400, Brad King  wrote:
> Jeremy Stout wrote:
> 
> > If I use those commands, here is what I get:
> >
> > [stout@energy stout]$ cd /usr/local/lib/vtk
> > [stout@energy vtk]$ nm libvtkParallel.so| c++filt| grep vtkMPIController::New
> > 0016db2c W vtkMPIController::NewInstanceInternal(void) const
> > 0016db50 W vtkMPIController::NewInstance(void) const
> > 00107000 T vtkMPIController::New(void)
> > [stout@energy vtk]$ nm libvtkGraphics.so| c++filt| grep vtkConeSource::New
> > 001dcb34 W vtkConeSource::NewInstanceInternal(void) const
> > 001dcb58 W vtkConeSource::NewInstance(void) const
> > 000d5df0 T vtkConeSource::New(void)
> >
> > It has been about a month since I compiled VTK, but I believe I
> > included MPI support.
> 
> Are you using the same version of GCC to build your program that you did
> to build VTK?  C++ is not link-compatible across compilers or even
> compiler versions (at least until the multi-vendor standard is widely
> accepted).
> 
> -Brad
> 
>
Mathieu Malaterre 1098290514Wed, 20 Oct 2004 16:41:54 +0000 (UTC)
Jeremy,

	What cmakelists file do you use to compile this ?
	By any chance do you have static lib of VTK somewhere in a path that 
can be found by g++ ? Compiling an example with vtk static libs 
*require* the use of cmake otherwise it's too much a trouble.

HTH
Mathieu

This one works for me:

FIND_PACKAGE(VTK)
IF (VTK_FOUND)
   INCLUDE (${VTK_USE_FILE})
ENDIF (VTK_FOUND)

ADD_EXECUTABLE(translator translator.cpp )
TARGET_LINK_LIBRARIES (translator
   vtkParallel
)

$ cat translator.cpp 

#include "vtkMPIController.h"
#include "vtkConeSource.h"

int main()
{
   vtkMPIController::New()->Delete();
   vtkConeSource::New()->Delete();
   return 0;
}Jeremy Stout wrote:
> If I use those commands, here is what I get:
> 
> [stout@energy stout]$ cd /usr/local/lib/vtk
> [stout@energy vtk]$ nm libvtkParallel.so| c++filt| grep vtkMPIController::New
> 0016db2c W vtkMPIController::NewInstanceInternal(void) const
> 0016db50 W vtkMPIController::NewInstance(void) const
> 00107000 T vtkMPIController::New(void)
> [stout@energy vtk]$ nm libvtkGraphics.so| c++filt| grep vtkConeSource::New
> 001dcb34 W vtkConeSource::NewInstanceInternal(void) const
> 001dcb58 W vtkConeSource::NewInstance(void) const
> 000d5df0 T vtkConeSource::New(void)
> 
> It has been about a month since I compiled VTK, but I believe I
> included MPI support.
> 
> Jeremy Stout
> 
> On Wed, 20 Oct 2004 15:29:27 -0400, Mathieu Malaterre
>  wrote:
> 
>>Jeremy,
>>
>>       What is the output of:
>>
>>nm libvtkParallel.so| c++filt| grep vtkMPIController::New
>>and
>>nm libvtkGraphics.so| c++filt| grep vtkConeSource::New
>>
>>I get:
>>
>>0016d0b6 T vtkMPIController::New()
>>0016ea3c W vtkMPIController::NewInstanceInternal() const
>>
>>and
>>
>>000c821e T vtkConeSource::New()
>>000c9604 W vtkConeSource::NewInstanceInternal() const
>>
>>If you don't get anything, that mean you didn't build VTK properly, turn
>>MPI on for example
>>
>>HTH
>>Mathieu
>>
>>
>>
>>
>>Jeremy Stout wrote:
>>
>>>Even when I use this command:
>>>
>>>g++ translator.cpp -otranslator -I/usr/local/include/vtk
>>>-I/usr/local/packages/mpich/include -L/usr/local/lib/vtk/ -lvtkCommon
>>>-lvtkDICOMParser -lvtkParallel -lvtkIO -lvtkGraphics -lvtkFiltering
>>>-lvtkHybrid -lvtkImaging -lvtkRendering -lvtkexpat -lvtkfreetype
>>>-lvtkftgl -lvtkjpeg -lvtkpng -lvt
>>>ktiff -lvtkzlib -L/usr/local/packages/mpich/lib -lmpich -ldl
>>>
>>>I get:
>>>
>>>/tmp/ccPx6BGK.o(.text+0x11): In function `main':
>>>: undefined reference to `vtkMPIController::New()'
>>>/tmp/ccPx6BGK.o(.text+0x36): In function `main':
>>>: undefined reference to `vtkConeSource::New()'
>>>collect2: ld returned 1 exit status
>>>
>>>I have no idea what is causing the error and I can't continue work on
>>>my program until I fix this. Thank you for your prompt response
>>>though.
>>>
>>>Jeremy Stout
>>>
>>>On Wed, 20 Oct 2004 14:19:32 -0400, tom fogal  wrote:
>>>
>>>
>>>><a6bc6cc04102007277b92dab4@mail.gmail.com>Jeremy Stout writes:
>>>>
>>>>
>>>>>Hello, I am trying to compile a VTK program with the following line:
>>>>>
>>>>>g++ translator.cpp -otranslator -I/usr/local/include/vtk
>>>>>-I/usr/local/packages/mpich/include -L /usr/local/
>>>>>lib/vtk/ -lvtkParallel  -L /usr/local/packages/mpich/lib -lmpich -ldl
>>>>
>>>>This is valid? I guess you learn something new everyday. I had always
>>>>though you could not have a space between -L and its argument, but you
>>>>seem to be using it and not getting link errors due to mpich...
>>>>
>>>>
>>>>
>>>>>Unfortunately, this results in the following error messages:
>>>>
>>>><snip>
>>>>
>>>>>/tmp/ccZVONeC.o(.text+0x11): In function `main':
>>>>>: undefined reference to `vtkMPIController::New()'
>>>>>/tmp/ccZVONeC.o(.text+0x36): In function `main':
>>>>>: undefined reference to `vtkConeSource::New()'
>>>>
>>>>You're forgetting to link in a library, my guess is vtkCommon. add in
>>>>'-lvtkCommon' to your link line and see if that fixes it. I wouldve
>>>>thought vtkMPIController would be in vtkParallel though...
>>>>
>>>>HTH,
>>>>
>>>>-tom
>>>>
>>>
>>>_______________________________________________
>>>This is the private VTK discussion list.
>>>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>>>Follow this link to subscribe/unsubscribe:
>>>http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>
>>
>
Home | About | Privacy