Hello,<br><br>I&#39;m trying to build a simplest MPICH2 C++ code with MinGW 4.6.1 on Windows 7 32-bit but getting linker errors:<br><br>test.cpp:<br><br>#include &quot;mpi.h&quot;<br><br>int main(int argc, char **argv) {<br>
  MPI::Init(argc, argv);<br>  MPI::Finalize();<br>  return 0;<br>}<br><br>D:\ASTU\Multithreading\Lab08\MPICH2&gt;g++ -Iinclude -Llib test.cpp -lcxx -lmpi<br>C:\Users\izbyshev\AppData\Local\Temp\ccaG6E2p.o:test.cpp:(.text+0x1c): undefined reference to `MPI::Init(i<br>
nt&amp;, char**&amp;)&#39;<br>C:\Users\izbyshev\AppData\Local\Temp\ccaG6E2p.o:test.cpp:(.text+0x21): undefined reference to `MPI::Finali<br>ze()&#39;<br>collect2: ld returned 1 exit status<br><br>I have no problems with C version of this code (linking to mpi.lib only). Visual Studio successfully builds both C and C++ versions.<br>
I wonder is it possible that MinGW is somehow incompatible with cxx.lib?<br><br>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. <br>
So for me the only option is to link to *.lib if I don&#39;t want to downgrade MinGW or use VS.<br><br>Don&#39;t know if it hepls, but VS shows these warnings when linking:<br><br>1&gt;LINK : warning LNK4098: defaultlib &#39;LIBCMT&#39; conflicts with use of other libs; use /NODEFAULTLIB:library<br>
1&gt;cxx.lib(initcxx1.obj) : warning LNK4099: PDB &#39;vc80.pdb&#39; was not found with &#39;cxx.lib(initcxx1.obj)&#39; or at &#39;D:\Trash\MPI\test\Debug\vc80.pdb&#39;; linking object as if no debug info<br>