| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:from:date:message-id:subject:to | |
| :content-type; q=dns; s=default; b=w2FYalUfdYcg5TNPTtEukEEf4ByBE | |
| XVCscPCs+T+7FJ9aF4jRbYe/59UQwq58rl8/kKDQGhVzsHBhITrYgeyLPnzwPLaZ | |
| K84sXj15tOfMhU+46DspyTkxwydMy3UPRTLEEagUvjkeO0HbALLZ0K3xlqYT6jXR | |
| WlHAJWBSiWKf3g= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:from:date:message-id:subject:to | |
| :content-type; s=default; bh=EC/MwUsU495oz4Dc3UdJ+XlDHuQ=; b=ymA | |
| XSMXvjjvKeEkCwtlOSi9XvgV2jsErKYP56FjZO2nVjp1Fogl3JxSVwJsVMt78rmi | |
| sFLsJo/Gg2lmg25SsS8p1ldxXo1LyfaB+sNaIvHwSu8CnTxzLo78ETwLnl/kesGS | |
| n4T/yblZtrsLLMltrQUjYjXqIbQgyub+fj9TLJtE= | |
| 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 |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=2.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 |
| X-HELO: | mail-vc0-f173.google.com |
| X-Received: | by 10.52.107.35 with SMTP id gz3mr5301925vdb.8.1394800989830; Fri, 14 Mar 2014 05:43:09 -0700 (PDT) |
| MIME-Version: | 1.0 |
| From: | rexdf Rexdf <weiyong DOT mao AT gmail DOT com> |
| Date: | Fri, 14 Mar 2014 20:42:49 +0800 |
| Message-ID: | <CAFrJEvN+Rckr6_XDYr5WUWLtYA6T6694bwPZAzUmR8OZdJ-_Zw@mail.gmail.com> |
| Subject: | Some Problems about gcc 4.8.2 on cygwin |
| To: | cygwin AT cygwin DOT com |
1.the following code:
#include <unistd.h>
#include <curses.h>
int main() {
initscr();
move(0, 0);
addstr("hello, world\n");
refresh();
sleep(5);
endwin();
return 0;
}
The following is my shell command:
$ pkg-config --libs --cflags ncurses
-I/usr/include/ncurses -lncurses
$ gcc $(pkg-config --libs --cflags ncurses) curses_test.c -o curses_test
/tmp/cc74H73T.o:curses_test.c:(.text+0xf): undefined reference to `initscr'
/tmp/cc74H73T.o:curses_test.c:(.text+0x14): undefined reference to
`ncwrap_stdscr'
/tmp/cc74H73T.o:curses_test.c:(.text+0x2c): undefined reference to `wmove'
/tmp/cc74H73T.o:curses_test.c:(.text+0x31): undefined reference to
`ncwrap_stdscr'
/tmp/cc74H73T.o:curses_test.c:(.text+0x49): undefined reference to `waddnstr'
/tmp/cc74H73T.o:curses_test.c:(.text+0x4e): undefined reference to
`ncwrap_stdscr'
/tmp/cc74H73T.o:curses_test.c:(.text+0x56): undefined reference to `wrefresh'
/tmp/cc74H73T.o:curses_test.c:(.text+0x67): undefined reference to `endwin'
/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld:
/tmp/cc74H73T.o: bad reloc address 0x20 in section `.eh_frame'
/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld:
final link failed: Invalid operation
collect2: error: ld returned 1 exit status
$ gcc curses_test.c $(pkg-config --libs --cflags ncurses) -o curses_test
$ ./curses_test.exe
Do I have to put the source file before `-I/usr/include/ncurses
-lncurses`? And why?
2.It's about OpenMP
openmp_1.cpp
#include <iostream>
#include <time.h>
void test()
{
int a = 0;
for (int i=0;i<100000000;i++)
a++;
}
int main()
{
clock_t t1 = clock();
for (int i=0;i<8;i++)
test();
clock_t t2 = clock();
std::cout<<"time: "<<t2-t1<<std::endl;
}
openmp_2.cpp
#include <iostream>
#include <time.h>
void test()
{
int a = 0;
for (int i=0;i<100000000;i++)
a++;
}
int main()
{
clock_t t1 = clock();
#pragma omp parallel for
for (int i=0;i<8;i++)
test();
clock_t t2 = clock();
std::cout<<"time: "<<t2-t1<<std::endl;
}
On cygwin
g++ openmp_1.cpp -o openmp_1.exe
g++ openmp_2.cpp -o opemnp_2.exe -fopenmp
time 1937
time 2297
On MingW-g++ 4.8.1
g++ openmp_1.cpp -o openmp_1.exe
g++ openmp_2.cpp -o opemnp_2.exe -fopenmp
time 1975
time 492
On Visual Studio 2013
Openmp_2.cpp Project
C/C++ --> Language --> Open MP Support yes(/openmp)
time 1849
time 321
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |