Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
4 ratings:
 3 out of 5     Rate this Document

Why Does my Application Segmentation Fault When Using the pthread Library?

Primary Software: Driver Software>>NI-DAQmx
Primary Software Version: 8.0
Primary Software Fixed Version: N/A
Secondary Software: Driver Software>>NI-DMM, Driver Software>>NI-FGEN, Driver Software>>NI-SCOPE

Problem:
I'm programming in C or C++ in Linux using the pthread library, and my application is experiencing segmentation faults. Are there any suggestions on how to fix this?


Solution:
When using the pthread library on Linux it is recommended to link your application with the gcc -pthread flag instead of linking directly with, for instance, -lpthread. If, after
replacing -lpthread, you still get a segmentation fault, you must explicitly link the dl library (-ldl) as the first library in your list.


Related Links:
http://www.ni.com/linux

Attachments:





Report Date: 02/16/2006
Last Updated: 02/16/2006
Document ID: 3OLENG00

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit