zoukankan      html  css  js  c++  java
  • 成功实现在VS2017下编译含<pthread.h>的代码:

    • VS2017配置使用#<pthread.h> https://blog.csdn.net/cry1994/article/details/79115394(原来SystemWow64里面存储的是32的文件.)
    • 配置后遇到的错误及解决方法:
      • pthread.h中报错:C2011 “timespec”:“struct”类型重定义   
      • 解决方法:在   

            #if !defined( PTHREAD_H )   

            #define PTHREAD_H   

            下面加上   

            #define HAVE_STRUCT_TIMESPEC //这将告诉pthreads的,Win32头,你已经有一个适当的timespec,并会让你的代码编译正常。                                                       

      • obj错误: 无法解析的外部符号 __imp__pthread_create,该符号在函数 _main 中被引用   
      • 解决方法: 在.cpp文件   

            #include <iostream>   

            #include <pthread.h>   

            using namespace std;   

            下边加上   

            #pragma comment(lib, "pthreadVC2.lib")//表示链接pthreadVC2.lib这个库。 和在工程设置里写上链入Ws2_32.lib的效果一样, 不过                                                        这种方法写的 程序别人在使用你的代码的时候就不用再设置工程settings了

    新战场:https://blog.csdn.net/Stephen___Qin
  • 相关阅读:
    shell75叠加
    shell73while ping测试脚本
    shell72while读文件创建用户
    shell70批量修改远程主机的ssh配置文件内容
    shell68批量创建用户(传多个参数)
    js限制input输入
    php获取textarea的值并处理回车换行的方法
    strtr对用户输入的敏感词汇进行过滤
    mysql执行语句汇总
    js倒计时防页面刷新
  • 原文地址:https://www.cnblogs.com/Stephen-Qin/p/9009592.html
Copyright © 2011-2022 走看看