Some Problems about gcc 4.8.2 on cygwin
Marco Atzeri
marco.atzeri@gmail.com
Fri Mar 14 14:12:00 GMT 2014
On 14/03/2014 13:42, rexdf Rexdf wrote:
> 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
try this way
gcc curses_test.c -o curses_test $(pkg-config --libs --cflags ncurses)
> 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
and the question is ?
Marco
--
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
More information about the Cygwin
mailing list