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 11-03-2005, 09:55 AM   #1
nathacof
Member
 
Registered: Aug 2004
Location: Bear, DE, USA
Distribution: Slackware 11, CentOS 5.2, Ubuntu
Posts: 124

Rep: Reputation: 17
Problems with boost


BTW this post is about a windows computer, but since I'm using primarily open source tools I figured what the hay.

OK so far I've run bjam -sTOOLS=mingw install which dumped a bunch of directories with header files into C:\boost\include\boost-1_33

I then tried this sample code http://www.boost.org/libs/filesystem.../simple_ls.cpp
(I've tried editing the #include line to suit my setup but to no avail)

No luck compiler spits out file not found errors anywhere I try to use boost.

In Dev-C++ I've edited the compiler options to include C:\boost\include (I moved all the directories from boost-1_33 to C:\boost\include, I didn't think this would be a problem) but I noticed the lib directory was empty (not sure if this matters) so I ran bjam -sTOOLS=mingw stage and dumped the library files into C:\boost\lib, also updated Dev-C++'s settings to search this directory for lib files.

Still the program won't compile. Same error every time. I even tried specifying the include path on the command line using g++.

Any help would be greatly appreciated.

Thanks.
 
Old 11-03-2005, 10:32 AM   #2
YetAnotherDave
Member
 
Registered: Feb 2005
Posts: 95

Rep: Reputation: 17
Is it important to you to use Dev-C++ ? I've been using cygwin/boost/mingw/g++ on the command line in windows with no problems. The sample program compiled fine for me. I can give you more info but I don't want to waste my time ( and yours ) if this is a solution that does not work for you.

- Dave
 
Old 11-03-2005, 12:20 PM   #3
nathacof
Member
 
Registered: Aug 2004
Location: Bear, DE, USA
Distribution: Slackware 11, CentOS 5.2, Ubuntu
Posts: 124

Original Poster
Rep: Reputation: 17
I have tried using g++ on the command line.
Code:
g++ simple_ls.cpp -o ls -IC:\boost\include -LC:\boost\lib -lboost
still I'm getting the same compiler error.
 
Old 11-03-2005, 01:16 PM   #4
YetAnotherDave
Member
 
Registered: Feb 2005
Posts: 95

Rep: Reputation: 17
Here's what works for me ( clean compile & link ):


Code:
g++ simple_ls.cpp -o ls  -Ic:\Boost\include\boost-1_33   -Lc:\Boost\lib -lboost_filesystem-gcc
This may not make any difference but when I installed boost, I used:

Code:
bjam "-sTOOLS=gcc" install
rather than:

Code:
bjam "-sTOOLS=mingw" install
 
Old 11-04-2005, 10:50 AM   #5
nathacof
Member
 
Registered: Aug 2004
Location: Bear, DE, USA
Distribution: Slackware 11, CentOS 5.2, Ubuntu
Posts: 124

Original Poster
Rep: Reputation: 17
OK I've done the install using -sTOOLS=gcc everything worked out pretty much the same. All the files are in c:\Boost\include\boost-1_33 using the same command as you've supplied I tried compiling from the command line with still the same results.

Can anyone tell me why this might be happening? I'm using boost supplied source code, and it compiles for everyone else... so this is kind of weird.

Perhaps it's because the directory I'm compiling from is in My Documents <- which contains a space in the name. I'll try from a new dir and get back to you guys.
 
Old 11-04-2005, 10:57 AM   #6
nathacof
Member
 
Registered: Aug 2004
Location: Bear, DE, USA
Distribution: Slackware 11, CentOS 5.2, Ubuntu
Posts: 124

Original Poster
Rep: Reputation: 17
OK this is the result of the compile after moving the source code to C:\src
Code:
C:\src>g++ simple_ls.cpp -o ls -LC:\boost\lib\boost-1_33 -IC:\boost\include\boos
t-1_33 -lboost_filesystem-gcc
C:\Dev-Cpp\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot f
ind -lboost_filesystem-gcc
collect2: ld returned 1 exit status

C:\src>
So this is an obvious improvement. Still I am unsure as to the usage of the -l arguement. If I leave it out I get a hole slew of errors. Hopefully I can figure this out.

Any help is appreciated.
 
Old 11-04-2005, 11:45 AM   #7
YetAnotherDave
Member
 
Registered: Feb 2005
Posts: 95

Rep: Reputation: 17
Your -L argument is wrong. Use:

Code:
g++ simple_ls.cpp -o ls -LC:\boost\lib -IC:\boost\include\boost-1_33 -lboost_filesystem-gcc
 
Old 11-04-2005, 12:04 PM   #8
nathacof
Member
 
Registered: Aug 2004
Location: Bear, DE, USA
Distribution: Slackware 11, CentOS 5.2, Ubuntu
Posts: 124

Original Poster
Rep: Reputation: 17
sheesh that worked. But now windows is complaining about missing boost_filesystem-gcc-1_33.dll. What's up with that?
 
Old 11-04-2005, 12:29 PM   #9
YetAnotherDave
Member
 
Registered: Feb 2005
Posts: 95

Rep: Reputation: 17
That's because the executable does not know where to find the dll. There are a few ways to fix this but probably the best way is to tell it where to look for the dll by modifying your Path variable as follows:

set Path=c:\Boost\lib;%Path%

There are ways to make this happen automatically for a new command window but I don't remember how offhand.

- Dave
 
Old 11-04-2005, 12:36 PM   #10
nathacof
Member
 
Registered: Aug 2004
Location: Bear, DE, USA
Distribution: Slackware 11, CentOS 5.2, Ubuntu
Posts: 124

Original Poster
Rep: Reputation: 17
Thanks for the help. I got it working! I copied the neccessary dll into the src directory. That works for now. I need to look into staticlly compiling but that's for another day.

Thanks again!
 
Old 11-04-2005, 12:56 PM   #11
YetAnotherDave
Member
 
Registered: Feb 2005
Posts: 95

Rep: Reputation: 17
Glad to hear you got it working!

Yes, copying the dll will work but it's not a very maintainable solution because you have to copy every boost shared library used by an executable to the folder of the executable. Not only that but you have to do this for every different folder at which you have created executables that use boost.

Static linking will also work but will result in larger executables that link slower. On the other hand it generates executables that are more self-contained and depend on a simpler run-time environment.

Of course, what works best for you depends on your circumstances.

- Dave
 
  


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
g++ and boost problem mixx Programming 1 07-20-2005 12:53 PM
Slackware performance boost Yalla-One Slackware 11 03-05-2005 04:05 PM
how to install Boost 1.3.20 chutsu Linux - Software 0 11-10-2004 02:22 PM
bass boost with sox mtb Linux - Software 2 08-22-2004 04:23 AM
Boost threading brianvdc Programming 1 10-16-2003 04:12 AM

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

All times are GMT -5. The time now is 11:26 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