私のパラレルプログラミングのC++コードで動作するnetbeansを設定しようとしています。私はコマンドライン(cygwin)を使ってそのコードをコンパイルすることができましたが、もっと複雑なものをさらにデバッグしてコード化するために、私はいくつかのIDEに移動して、自分の仕事をするためにneatbeansを選択したいと思っています。誰かが、私がnetbeansで自分のアプリケーションボタンをビルドすると、-fopenmp
を追加して自分のアプリケーションをコンパイルする方法を提案できますか? (すでにnetbeans_とGCCとG ++を設定している以下は、私は、NetBeansを使用して私のコードをビルドする場合、私は取得エラーです:。g ++とgccで設定されたnetbeansで-fopenmpを使用してコンパイルします
cd 'D:\University\PARALLEL\ParallelTesting'
C:\dev_softwares\cygwin64\bin\make.exe -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/d/University/PARALLEL/ParallelTesting'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/paralleltesting.exe
make[2]: Entering directory '/cygdrive/d/University/PARALLEL/ParallelTesting'
mkdir -p dist/Debug/Cygwin-Windows
g++ -o dist/Debug/Cygwin-Windows/paralleltesting build/Debug/Cygwin-Windows/main.o
build/Debug/Cygwin-Windows/main.o: In function `main':
/cygdrive/d/University/PARALLEL/ParallelTesting/main.cpp:26: undefined reference to `omp_get_thread_num'
/cygdrive/d/University/PARALLEL/ParallelTesting/main.cpp:26:(.text+0x15): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `omp_get_thread_num'
/cygdrive/d/University/PARALLEL/ParallelTesting/main.cpp:32: undefined reference to `omp_get_num_threads'
/cygdrive/d/University/PARALLEL/ParallelTesting/main.cpp:32:(.text+0x34): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `omp_get_num_threads'
collect2: error: ld returned 1 exit status
nbproject/Makefile-Debug.mk:62: recipe for target 'dist/Debug/Cygwin-Windows/paralleltesting.exe' failed
は、ps:NetBeansの持つ並列プログラミングと、すでに設定さGCCの世界に新しい
。私のテスト平行コード:
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{
int nthreads, tid;
/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(nthreads, tid)
{
/* Obtain thread number */
tid = omp_get_thread_num();
printf("Hello World from thread = %d\n", tid);
/* Only master thread does this */
if (tid == 0)
{
nthreads = omp_get_num_threads();
printf("Number of threads = %d\n", nthreads);
}
} /* All threads join master thread and disband */
}
はい、私でした。私の質問を更新し、私のテスト並列プログラムを追加しました。 – ManinGreen
追加のコンパイラフラグを追加する場所があります:[ここをクリック](http://forums.netbeans.org/post-51329.html) –
すごくうれしいです。 – ManinGreen