[mpich-discuss] Q:can compile but can't link in windows

孔涛 hawk_kongtao at yahoo.com.cn
Wed Oct 6 05:26:31 CDT 2010


Hello, I have installed GCC & MPICH2-1.2.1p1 for windows  with editplus 3 on my 
winows 7 platform. I configure them following the"README.winbin"file in mpich2.
and It works well with c/fortran.
 
but if i use the c++ mode, which means, using "MPI::Int(), 
MPI::COMM_WORLD.Getsize(),etc." instead of 
"MPI_Init(&argc,&argv),MPI_Comm_size(MPI_COMM_WORLD,&size).etc" , It failed .
 
If the source file has any grammar mistake, when compling, the g++ can point it 
out.
 
After I correct them, when I build them again, It shows :
-------------------------------------------------------------
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text+0x5f): unde
fined reference to `MPI::Init()'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text+0x66): unde
fined reference to `MPI::COMM_WORLD'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text+0x9c): unde
fined reference to `MPI::DOUBLE'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text+0x201): und
efined reference to `MPI::COMM_WORLD'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text+0x233): und
efined reference to `MPI::COMM_WORLD'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text+0x26a): und
efined reference to `MPI::COMM_WORLD'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text+0x316): und
efined reference to `MPI::DOUBLE'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text+0x32c): und
efined reference to `MPI::COMM_WORLD'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text+0x3b7): und
efined reference to `MPI::Finalize()'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text$_ZN3MPI8Dat
atypeC1Ev[MPI::Datatype::Datatype()]+0x8): undefined reference to `vtable for MP
I::Datatype'
C:\Users\Vikram\AppData\Local\Temp\ccKmyYIt.o:mpi_derived.cpp:(.text$_ZN3MPI8Dat
atypeD1Ev[MPI::Datatype::~Datatype()]+0xb): undefined reference to `vtable for M
PI::Datatype'
collect2: ld returned 1 exit status
Press any key to continue....
----------------------------------------------------------
However ,if I replace all the MPI::XXX kind (C++ mode )to MPI_XXX( C mode ), It 
works. Every thing is well
I don't know why, can you help me?
 
---
when compiling I use the following command:
g++ -I D:\MPICH2\include -L D:\MPICH2\lib $(FileName) -o $(FileNameNoExt) -lmpi
 
---
Waiting for your Reply. Wish everything well for you!
 
---------------------------------------------------
孔涛     山东大学数学学院


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20101006/b0df36fb/attachment.htm>


More information about the mpich-discuss mailing list