[mpich-discuss] Linking to cxx.lib with MinGW 4.6.1

Jayesh Krishna jayesh at mcs.anl.gov
Wed Jan 4 11:03:11 CST 2012


Hi,
 It is possible that MinGW compilers is incompatible with cxx.lib built using VS . Did you try specifying the libraries like object files (Just specify cxx.lib and mpi.lib to the compiler without using the "-l" option)? 
 We regularly test the libs (*.a libs) with g++/gcc from Cygwin (The 32-bit libs are created using g++ from Cygwin, not MinGW compilers).

Regards,
Jayesh

----- Original Message -----
From: "Alexey Izbyshev" <izbyshev at gmail.com>
To: mpich-discuss at mcs.anl.gov
Sent: Wednesday, December 28, 2011 7:00:28 AM
Subject: [mpich-discuss] Linking to cxx.lib with MinGW 4.6.1


Hello, 

I'm trying to build a simplest MPICH2 C++ code with MinGW 4.6.1 on Windows 7 32-bit but getting linker errors: 

test.cpp: 

#include "mpi.h" 

int main(int argc, char **argv) { 
MPI::Init(argc, argv); 
MPI::Finalize(); 
return 0; 
} 

D:\ASTU\Multithreading\Lab08\MPICH2>g++ -Iinclude -Llib test.cpp -lcxx -lmpi 
C:\Users\izbyshev\AppData\Local\Temp\ccaG6E2p.o:test.cpp:(.text+0x1c): undefined reference to `MPI::Init(i 
nt&, char**&)' 
C:\Users\izbyshev\AppData\Local\Temp\ccaG6E2p.o:test.cpp:(.text+0x21): undefined reference to `MPI::Finali 
ze()' 
collect2: ld returned 1 exit status 

I have no problems with C version of this code (linking to mpi.lib only). Visual Studio successfully builds both C and C++ versions. 
I wonder is it possible that MinGW is somehow incompatible with cxx.lib? 

I also tried to link to lib*.a but got unresolved references to SjLj-related functions. I found out that it is due an old version of MinGW used to build those lib*.a. 
So for me the only option is to link to *.lib if I don't want to downgrade MinGW or use VS. 

Don't know if it hepls, but VS shows these warnings when linking: 

1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library 
1>cxx.lib(initcxx1.obj) : warning LNK4099: PDB 'vc80.pdb' was not found with 'cxx.lib(initcxx1.obj)' or at 'D:\Trash\MPI\test\Debug\vc80.pdb'; linking object as if no debug info 

_______________________________________________
mpich-discuss mailing list     mpich-discuss at mcs.anl.gov
To manage subscription options or unsubscribe:
https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss


More information about the mpich-discuss mailing list