zoukankan      html  css  js  c++  java
  • Linux g++ 编译添加 pthread

    If you are going to compile a C program with pthread.h in LINUX using GCC or G++ you will have to use –lpthread option after the compile command.

    gcc xyz.c -o xyz -lpthread
    

    Here,

    gcc is compiler command (compiler name)

    xyz.c is a source file name.

    -o is an option to create objcect file.

    xyz is the name of object (binary) file.

    -lpthread is an option for pthread.h

    for more details here is the link conatining complete article on it.

    Compiling C program with pthread.h in Linux.

    pthread库不是 Linux 默认的库,有些 Library 默认使用pthread但是在介绍的时候没有说明,导致编译时出错。-lpthread-pthread两种写法好像都可以。

  • 相关阅读:
    codeforces
    hdu
    hdu
    poj 2823
    hdu
    hdu
    hdu
    微信公众号 SDK
    PHP 正则表达式
    注册和登录时的验证码
  • 原文地址:https://www.cnblogs.com/yaos/p/10513162.html
Copyright © 2011-2022 走看看