Sign in to follow this  
Amnesiac5

Boost and VC++ Express fatal link error

Recommended Posts

Well, I decided to bite the bullet and install Boost. After much faffing about trying to follow the cryptic and arcane instructions at Boost.org and heavy use of Google I was finally able to build it using bjam. However, now I'm trying to build a short test console program
#include <iostream>
#include <cassert>
#include <string>
#include "boost/regex.hpp"

int main()
{
  boost::regex reg("\\d{3}([a-zA-Z]+).(\\d{2}|N/A)\\s\\1");

  std::string correct="123Hello N/A Hello";
  std::string incorrect="123Hello 12 hello";

  assert(boost::regex_match(correct,reg)==true);
  assert(boost::regex_match(incorrect,reg)==false);
}
and I'm getting the following error.
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc80-mt-gd-1_33_1.lib'
I've scoured Google and GameDev.net, messed about with project settings and the vsvars32.bat file but all to no avail. Any help or suggestions as to how sort this would be most appreciated. [smile] TIA A5

Share this post


Link to post
Share on other sites
Quote:
Original post by Amnesiac5
Well, I decided to bite the bullet and install Boost. After much faffing about trying to follow the cryptic and arcane instructions at Boost.org and heavy use of Google I was finally able to build it using bjam.

I really fail to see why people have such a problem building boost. The instructions are perfectly clear. Which part did you have problems with?
Quote:
However, now I'm trying to build a short test console program

*** Source Snippet Removed ***
and I'm getting the following error.

*** Source Snippet Removed ***
I've scoured Google and GameDev.net, messed about with project settings and the vsvars32.bat file but all to no avail. Any help or suggestions as to how sort this would be most appreciated. [smile]

TIA

A5


Do you have a successfully built libboost_regex-vc80-mt-gd-1_33_1.lib file? Is it on the libs path for your project?

Σnigma

Share this post


Link to post
Share on other sites
Hi Snigma (I really fail to see why people can't be bothered to learn the Greek alphabet... Σ = sigma hence has an "ess" sound.)

Quote:
Original post by Enigma
I really fail to see why people have such a problem building boost. The instructions are perfectly clear. Which part did you have problems with?
Do you really want to get into that? I'm afraid that I didn't find the instructions perfectly clear, e.g.
Quote:
The user sets up all of the environment for each toolset he wants to use in the normal way.
Toolset? Environment? Normal way?!? Sorry, lost me right there. And I'm afraid it just gets worse after that. (Truthfully, earlier discussion of cvs, .tar.gz, .tar.bz2, boostbook, Perforce etc. confused the blazes out of me.) Maybe I'm just too stupid to live.

During the build process I opened a command prompt from VCEE, and had to
set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include;%INCLUDE%
and
set LIB=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;%LIB%
to get a successful(?) build.
Quote:
Original post by Enigma
Do you have a successfully built libboost_regex-vc80-mt-gd-1_33_1.lib file? Is it on the libs path for your project?

libboost_regex-vc80-mt-gd-1_33_1.lib can be found in
C:\boost\bin\boost\libs\regex\build\libboost_regex.lib\vc-8_0\debug\threading-multi\ on my machine, so, I assume it built successfully.

I added C:\boost\include\boost-1_33_1 to
Tools-> Options-> Projects and Solutions-> VC++ Directories (Include files) and
C:\boost\lib to
Tools-> Options-> Projects and Solutions-> VC++ Directories (Library files).
Do I need to more? (I can't find where it explains which setting are required.)

TIA

A5

Share this post


Link to post
Share on other sites
If you point the library directory at some place, and have the library file somewhere else, then of course it can't find it. You probably just build the files, but didn't install it. Check step 5 in the getting started guide. Building without the install-option will just build the files, not collect them in any specific place.

Share this post


Link to post
Share on other sites
Building boost takes a bit of reading, yeah, but all the information you need are in the documentation. (Specifically, this page shows you 1) Which toolsets you can choose between (and once you see the list, it should be fairly obvious what they mean by toolset. [grin]), and 2) which arguments you can pass to bjam:

bjam [options...] [install|stage]

And just below this line, it tells you what install and stage does. It also tells you the possible options you can supply. So all that's left now is to fill in the couple of options you find relevant.

As for the bit about .zip (you know what a zip file is, right?), .tar.gz and cvs, well, they're all listed under the Download section, which could be a hint that they refer to simply different ways to download boost, and different file formats. In other words, once you have downloaded the files, you don't need to worry about this section.

Anyway, you can also download it all as precompiled lib/dll's. :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Amnesiac5
Hi Snigma (I really fail to see why people can't be bothered to learn the Greek alphabet... Σ = sigma hence has an "ess" sound.)

I'm perfectly aware of the Greek alphabet thankyou. I use the Sigma as a stylised E. I've also been known to go by the moniker 'Snigma' when Enigma is unavailable.

Quote:
Do you really want to get into that? I'm afraid that I didn't find the instructions perfectly clear, e.g.
Quote:
The user sets up all of the environment for each toolset he wants to use in the normal way.
Toolset? Environment? Normal way?!? Sorry, lost me right there. And I'm afraid it just gets worse after that. (Truthfully, earlier discussion of cvs, .tar.gz, .tar.bz2, boostbook, Perforce etc. confused the blazes out of me.) Maybe I'm just too stupid to live.

Sorry, I meant "clear to me". However, the the sentence following "The user sets up all of the environment for each toolset he wants to use in the normal way." is "For example, for Microsoft VC++, ...VC98/Bin or .../VC7/Bin is in the PATH environment variable, VCVARS32.BAT or VSVARS32.BAT has been invoked, etc". Is that really that's hard to understand?

I mean, come on. Boiling down the instructions to remove information which is not relevant to you:
  1. The Boost Libraries are distributed through the SourceForge file distribution system. Click here to download releases from SourceForge. And unpack the release to a convenient location.
    [short version: download the linked zip file and extract it]

  2. The build system uses Boost.Jam, an extension of the Perforce Jam portable make replacement. The recommended way to get Boost.Jam if you are using a Boost distribution is to download a prebuilt executable from SourceForge. ... To install Boost.Jam, copy the bjam executable to a location accessible in your PATH.
    [short version: boost has it's own build system. Get it from the given link. Make sure your operating is able to find bjam by making sure it's on the system path]

  3. Before using Boost.Build you will need to configure the compiler tools you are using. The build system's toolsets are designed to work in either of two ways:
    1. The user sets up all of the environment for each toolset he wants to use in the normal way. For example, for Microsoft VC++, ...VC98/Bin or .../VC7/Bin is in the PATH environment variable, VCVARS32.BAT or VSVARS32.BAT has been invoked, etc.
    [short version: make sure your compilers bin directory is on the system path (scroll down to discussion of "The PATH Environment Variable"), so that it can be invoked from the commandline without supplying a full path. Run VCVARS32.bat or VSVARS32.bat]

  4. First you need to change to the directory where you have the Boost distribution you downloaded. For example:
    chdir boost-1.31.0
    [short version: navigate to the directory where you extracted boost to]

  5. Invoke the build system, specifying the toolset(s) you wish to use, to build and install.
    [short version: type bjam "-sTools=vc-8_0" install <enter>]
Σnigma

Share this post


Link to post
Share on other sites
Quote:
Original post by Brother Bob
If you point the library directory at some place, and have the library file somewhere else, then of course it can't find it. You probably just build the files, but didn't install it. Check step 5 in the getting started guide. Building without the install-option will just build the files, not collect them in any specific place.

I opened a command prompt,
changed my working directory to c:\boost
then typed bjam "-sTOOLS=vc-8_0" install

did I miss something?

Share this post


Link to post
Share on other sites
Quote:
Original post by Amnesiac5
libboost_regex-vc80-mt-gd-1_33_1.lib can be found in
C:\boost\bin\boost\libs\regex\build\libboost_regex.lib\vc-8_0\debug\threading-multi\ on my machine, so, I assume it built successfully.

I added C:\boost\include\boost-1_33_1 to
Tools-> Options-> Projects and Solutions-> VC++ Directories (Include files) and
C:\boost\lib to
Tools-> Options-> Projects and Solutions-> VC++ Directories (Library files).
Do I need to more? (I can't find where it explains which setting are required.)

Okay, so you added those two last directories to your compiler configuration. Do those directories even exist? It looks like the bjam utility didn't copy those files to the include or library directories. I'm not sure if that's what bjam is meant to do or not (I just used the installer package found at Boost Consulting )

Share this post


Link to post
Share on other sites
Quote:
Original post by nobodynews
Quote:
Original post by Amnesiac5
I added C:\boost\include\boost-1_33_1 to
Tools-> Options-> Projects and Solutions-> VC++ Directories (Include files) and
C:\boost\lib to
Tools-> Options-> Projects and Solutions-> VC++ Directories (Library files).
Do I need to more? (I can't find where it explains which setting are required.)

Okay, so you added those two last directories to your compiler configuration. Do those directories even exist? It looks like the bjam utility didn't copy those files to the include or library directories. I'm not sure if that's what bjam is meant to do or not (I just used the installer package found at Boost Consulting )

Yes, those directories do exist.

I had thought about using the Boost Consulting installer package, but it states that it's for Visual C++ 7.1 and/or 8.0. Is it compatible with VC++ Express? And how would I go about removing the existing botched "installation? I can then either try again from scratch or use the Boost Consulting installer package.

It's just so damned frustrating that I (and others) find installing Boost so difficult and frustrating. I really would love to know out where I'm going wrong. Hey, that's how we learn from our mistakes.

Share this post


Link to post
Share on other sites
Quote:
Original post by Amnesiac5
Quote:
Original post by Brother Bob
If you point the library directory at some place, and have the library file somewhere else, then of course it can't find it. You probably just build the files, but didn't install it. Check step 5 in the getting started guide. Building without the install-option will just build the files, not collect them in any specific place.

I opened a command prompt,
changed my working directory to c:\boost
then typed bjam "-sTOOLS=vc-8_0" install

did I miss something?

If that's what you did, and you haven't changed any other parameters somewhere, you must have missed something. Are you sure the install script finished successfully?

Share this post


Link to post
Share on other sites
AFAICT, there's a bug in the new bjam system which makes the outputted libraries have a "vc" identifier instead of a "vc80" identifier if you follow the posted instructions. If you like, you can simply add the "80" after the identifier yourself and things will work fine. Alternatively, edit the tools/build/v2/user-config.jam file and add "using msvc : 8.0 ;" on a line at the end, then rebuild (leaving out the toolset argument).

Share this post


Link to post
Share on other sites
Quote:
Original post by Amnesiac5
It's just so damned frustrating that I (and others) find installing Boost so difficult and frustrating. I really would love to know out where I'm going wrong. Hey, that's how we learn from our mistakes.

Have you followed the cut down instructions exactly as I posted (minus typos)? What messages did you get back from bjam it terms of targets built/updated?
Quote:
I had thought about using the Boost Consulting installer package, but it states that it's for Visual C++ 7.1 and/or 8.0. Is it compatible with VC++ Express?

Well, it'll be compatible with Visual C++ 8.0 Express Edition, which I assume is what you have.

Σnigma

Share this post


Link to post
Share on other sites
Quote:
Original post by Amnesiac5
libboost_regex-vc80-mt-gd-1_33_1.lib can be found in
C:\boost\bin\boost\libs\regex\build\libboost_regex.lib\vc-8_0\debug\threading-multi\ on my machine, so, I assume it built successfully.


Am i missing something? You say the .lib file is in "C:\boost\bin\... and so on", and then you say this:

Quote:

I added C:\boost\include\boost-1_33_1 to
Tools-> Options-> Projects and Solutions-> VC++ Directories (Include files) and
C:\boost\lib to
Tools-> Options-> Projects and Solutions-> VC++ Directories (Library files).
Do I need to more? (I can't find where it explains which setting are required.)


Is "C:\boost\bin" set up in your VC++ directories?

Share this post


Link to post
Share on other sites
Quote:
Original post by Enigma
Quote:
Original post by Amnesiac5
It's just so damned frustrating that I (and others) find installing Boost so difficult and frustrating. I really would love to know out where I'm going wrong. Hey, that's how we learn from our mistakes.

Have you followed the cut down instructions exactly as I posted (minus typos)? What messages did you get back from bjam it terms of targets built/updated?
Quote:
I had thought about using the Boost Consulting installer package, but it states that it's for Visual C++ 7.1 and/or 8.0. Is it compatible with VC++ Express?

Well, it'll be compatible with Visual C++ 8.0 Express Edition, which I assume is what you have.

Σnigma

Well, b*gg*r me bandy. It seems to have worked. The only difference between your list of steps and what I had done previously was running VCVARS32.bat.

Now, I'm just a bit worried that I've got piles of garbage left from my earlier attempts, which I'll try to clear up.

Many thanks for the assist to everyone (and Σnigma in particular cos you were right... smart alec [wink]).

I guess I'll have to learn what Boost can do, now.

Right, let's see what a mess I can make of Ogre (no binaries for Crystal Space sigh).

Share this post


Link to post
Share on other sites
A final point, I suppose this shows that the instructions on the Boost site aren't all that clear as I was able to follow Σnigma's quite well, but not theirs.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this