www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/01/08/03:09:28

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4B46E838.9050803@users.sourceforge.net>
Date: Fri, 08 Jan 2010 02:09:28 -0600
From: "Yaakov (Cygwin/X)" <yselkowitz AT users DOT sourceforge DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: gcc4: OpenMP vs. <math.h>
References: <4B46E171 DOT 4060603 AT users DOT sourceforge DOT net>
In-Reply-To: <4B46E171.4060603@users.sourceforge.net>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------010509060107030700050701
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit

On 08/01/2010 01:40, Yaakov (Cygwin/X) wrote:
> However, I just encountered tonight a much larger conflict: OpenMP/C++
> and <math.h> are incompatible. STC attached:

Here's the file I meant to attach.


Yaakov

--------------010509060107030700050701
Content-Type: text/plain;
 name="openmp.cxx"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="openmp.cxx"

// http://en.wikipedia.org/wiki/OpenMP#Hello_World
// with an #include <math.h>
// if you also #include <algorithm>, this *really* blows up

#include <math.h>
#include <omp.h>
#include <iostream>

int main (int argc, char *argv[]) {
	int th_id, nthreads;
#pragma omp parallel private(th_id)
	{
		th_id = omp_get_thread_num();
		std::cout << "Hello World from thread" << th_id << "\n";
#pragma omp barrier
		if ( th_id == 0 ) {
			nthreads = omp_get_num_threads();
			std::cout << "There are " << nthreads << " threads\n";
		}
	}
	return 0;
}


--------------010509060107030700050701
Content-Type: text/plain; charset=us-ascii

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
--------------010509060107030700050701--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019