2017-03-16 16 views
0

私はMPIを使用して簡単なプログラムを作成することができます。私はmpi.hヘッダを使用して、それをコンパイルするのDev C++でのHello Worldプログラムを試した後、makefile.winもプロジェクトオプションでディレクトリを(エラー)Dev C++のMPIへの未定義参照

D:\Assignment\Project\MPI\tesmpi.o tesmpi.cpp:(.text+0x21): undefined reference to `MPI_Init' 
D:\Assignment\Project\MPI\tesmpi.o tesmpi.cpp (.text$_ZN3MPI9IntracommC2Ev[__ZN3MPI9IntracommC2Ev]+0xf): undefined reference to `MPI::Comm::Comm()' 
... and other 190 errors like that 
D:\Assignment\Project\MPI\[Error] id returned 1 exit status 
D:\Assignment\Project\MPI\recipe for target 'Project' failed 

私はすでに入力ライブラリが来て含まれ登場するとエラーに従っていますmsmpi.libとのリンカ。私はMicrosoft MPIとMicrosoft SDKをMPIに使用しています。私ができることは何ですか?

これは私のプログラム

#include <mpi.h> 
#include <stdio.h> 

int main(int argc, char** argv) { 
    // Initialize the MPI environment 
    MPI_Init(NULL, NULL); 

    // Get the number of processes 
    int world_size; 
    MPI_Comm_size(MPI_COMM_WORLD, &world_size); 

    // Get the rank of the process 
    int world_rank; 
    MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); 

    // Get the name of the processor 
    char processor_name[MPI_MAX_PROCESSOR_NAME]; 
    int name_len; 
    MPI_Get_processor_name(processor_name, &name_len); 

    // Print off a hello world message 
    printf("Hello world from processor %s, rank %d" " out of %d processors\n", 
     processor_name, world_rank, world_size); 

    // Finalize the MPI environment. 
    MPI_Finalize(); 

}

答えて

0

どのようにあなたのプログラムをコンパイルしたのでしょうか?これを行うには、通常のC++コンパイラではなく、mpic++コマンドを使用する必要があります。

+0

dev C++コンパイラでいつものようにプログラムをコンパイルしますが、dev C++コンパイラに 'mpiC++'を追加するには?それともcmdを使って行うことができますか? – newcomers

0

現在の問題は、Dev C++リンカにMPIライブラリを使用するよう通知していないことを意味します。

configsには、使用するライブラリを指定する場所があります。

+0

次に、それはどこですか? – newcomers

関連する問題