LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2005, 03:50 AM   #1
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Rep: Reputation: 30
Simple Link problem


I link my program with this
g++ -0 unittest unittest.cpp baseobject.cpp thread.cpp libthread.a

which results in Segmentation Fault when being run
on
pthread_create (&tid, NULL, &my_func, NULL);

Why there is seg fault when the linker did not complain?
I ran it thru the debugger, i found my_func to be not NULL and tid is 0, what is the problem? is it some dynamic library or static library link problems?
Thanks
Jack
 
Old 12-07-2005, 07:24 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
tid needs to be set up to point to a valid memory address. pthread_create returns the tread id into this memory address.

graeme
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Redhat 8.0 Symbolic Link Problem & Maillog Problem. borisys Red Hat 1 07-27-2004 09:35 AM
Simple link list problem karlan Programming 4 01-22-2004 01:05 PM
simple link question (ln) true_atlantis Linux - Newbie 1 12-02-2003 02:08 PM
Link problem please help talonnb Linux - Newbie 3 08-02-2003 03:12 PM
Simple program link as Dockapp in Fluxbox Nerd2 Linux - Software 1 05-31-2003 08:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration