Current location: Hot Scripts Forums » Programming Languages » C/C++ » Help with pthreads in Dev-C++


Help with pthreads in Dev-C++

Reply
  #1 (permalink)  
Old 02-08-07, 03:17 PM
daisuki daisuki is offline
New Member
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Help with pthreads in Dev-C++

Hi all,

I'm new here. But, I was wondering if I could get some help with running pthreads in Bloodshed Dev-C++. I downloaded the pthreads.DevPack and installed it, but when I compile my program I'm making for my class I get linker errors.

[Linker error] undefined reference to `_imp__pthread_attr_init'
[Linker error] undefined reference to `_imp__pthread_create'
[Linker error] undefined reference to `_imp__pthread_join'
[Linker error] undefined reference to `_imp__pthread_exit'
[Linker error] undefined reference to `_imp__pthread_mutex_init'
[Linker error] undefined reference to `_imp__pthread_cond_init'
[Linker error] undefined reference to `_imp__pthread_mutex_lock'
[Linker error] undefined reference to `_imp__pthread_mutex_unlock'
[Linker error] undefined reference to `_imp__pthread_exit'
ld returned 1 exit status

I was wondering if anyone could tell me what I could do to fix it.

Thanks,
Emily
Reply With Quote
  #2 (permalink)  
Old 02-09-07, 05:55 AM
Steelman's Avatar
Steelman Steelman is offline
Community VIP
 
Join Date: Aug 2004
Location: United Kingdom
Posts: 399
Thanks: 1
Thanked 1 Time in 1 Post
Moved to C/C++
__________________
Paul Williamson
HotScripts.com Listings Editor - paul@hotscripts.com
Submit your own script to the HotScripts Directory.
► Don't forget to read the submission guidelines before submitting your script.
Reply With Quote
  #3 (permalink)  
Old 03-15-07, 05:03 AM
PurpleHead PurpleHead is offline
New Member
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
I've the same problem..but i don't understood the answer..Can somebody help me?? Thanks a lot
Reply With Quote
  #4 (permalink)  
Old 03-17-07, 02:03 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Linker errors usually mean that you forgot to link in the .lib files from the libraries you are using. It can also happen if you declare methods in a class, but never define them and then try to use them.

You'll have to tell your IDE in which directories to look for the libs, and also tell it which .lib files it depend upon.

In Visual Studio you can find these settings under Tools->Options->Projects and Solutions->VC++ Directories. Change the Drop-down list to Library files and add the directory with the libs there.

Then go to Project->Projectname Options->Configuration properties->Linker->Input and put the .lib filenames you need under Additional Dependencies. If you need more than one file, separate them with spaces.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
  #5 (permalink)  
Old 03-19-07, 03:33 AM
PurpleHead PurpleHead is offline
New Member
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up allll right!!

i've installed the "pthreads devpack" at http://devpaks.org/details.php?devpak=118
but..it doesn't work..
do you know another way for use the pthread library in dev c++??

Thanks a lot..

Luka

Last edited by PurpleHead; 03-19-07 at 04:01 AM.
Reply With Quote
  #6 (permalink)  
Old 04-06-07, 02:29 PM
lord0din69 lord0din69 is offline
New Member
 
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
You can download pthreads at http://sourceware.org/pthreads-win32/
you can look at the FAQ at the bottom of the website for instructions to install Pthreads. Look for question 8, How do I use pthread.dll for Win32 (Visual C++ 5.0)

Additionally for dev c++ users you need to create a project in order to link the pthreads library.
To do so make a new project, toss the code that you are working on into the project, and then link the pthreads by doing the following

Go to the tab named Project>Project Options (Alt+P)
a window will open up and then go to parameters
and you'll see three sections, compiler, c++ compiler, and linker
add the pthreads into the linker
The files you are looking for is in the folder Pre-built>lib which you have downloaded from http://sourceware.org/pthreads-win32/

Hope that helps

Last edited by lord0din69; 04-06-07 at 02:32 PM.
Reply With Quote
  #7 (permalink)  
Old 07-07-10, 10:27 AM
mctaco mctaco is offline
New Member
 
Join Date: Jul 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up thanks lord0din69

@lord0din69: Very nice, thank you for this source and help. Some people out there reckon that it is not possible to work with threads in c for windows. I prefer working with Dev C++ due to simplicity when compiling and because of the graphic help it offers....
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Python/Zope Dev, Rockville, MD | 60-100k | Relo OK superiorss Job Offers & Assistance 0 02-20-06 10:26 PM
Trouble with Input in Dev C++ Titan145 C/C++ 3 05-17-05 07:07 AM
Need a web dev job? klute General Advertisements 0 04-27-05 10:58 AM
How can I create a local dev server? mortgage-pro-seo Web Servers 1 02-13-05 01:05 PM
Image gallery dev and a question Trel PHP 1 01-06-05 10:23 AM


All times are GMT -5. The time now is 04:39 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.