Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Other Topics > Programming

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 07-27-2012, 12:19 PM   #1
journeyman
 
Join Date: Mar 2009
Posts: 264
Help needed when using boost with Visual Studio 2010 Professional

Hello,

I am currently trying to build a static library (not boost) from source code which #include's boost code. I have the directory in which boost sits added in

Project> Properties> Configuration Properties> C/C++> General> Additional Include directories

When I build the library I get 65 errors, all related to the boost libraries. In particular hash.hpp and extension.hpp.


I am sorry that the image is difficult to read. If more specific images/details are needed please just ask and I will provide.

Does anyone know what is happening here? Is it settings within Visual Studio as I figure boost should all be 'error free' 'out of the box'.

One of the errors that confuses me most is not shown in the picture but

Code:
error C2039: 'array' : is not a member of 'std'	c:\lxc01m\libraries\boost\boost\functional\hash\extensions.hpp
referring to the code

Code:
#if !defined(BOOST_NO_0X_HDR_ARRAY)
    template <class T, std::size_t N>
    std::size_t hash_value(std::array<T, N> const& v)
    {
        return boost::hash_range(v.begin(), v.end());
    }
#endif
but a quick google search seems to confirm that it does. Besides, why would boost be so popular, and used in the other library I am trying to build, if the code was incorrect.

I am sure there is something I am fundamentally doing wrong but I have been working on this for hours and I still have no idea what is going on...

Any help would be greatly appreciated.

Apologies if this is posted in the wrong place or any etiquette is wrong. I am just have NO idea what is going on and getting to my wits end.

Many thanks.
dontbeleivethehype is offline   Reply With Quote
Old 07-27-2012, 12:39 PM   #2
help me help you
 
Chips Ahoy's Avatar
 
Join Date: Apr 2007
Location: up-at-dawn, pride-swallowing siege
Posts: 21,303
Re: Help needed when using boost with Visual Studio 2010 Professional

boost does just work out of the box.

1. Are you including the right directory?

On this machine I include C:\Program Files (x86)\boost\boost_1_47

2. Did you install the right stuff? I use the boostpro installer. You need different stuff depending on your CRT settings. Just select them all. Are you doing 32 bit or 64 bit?

3. Simplify your problem. Make a hello world app. Include a boost header. Build.

4. Windows headers can have macros that mess stuff up. There are always workarounds.

What are the #include lines?
#include <boost/functional/hash.hpp>

works for me. I don't know extension.hpp.

It's always better to take something that works and modify it than take something that doesn't and beat your head against the wall.
Chips Ahoy is offline   Reply With Quote
Old 07-27-2012, 07:10 PM   #3
gwp
grinder
 
gwp's Avatar
 
Join Date: Jan 2006
Location: Achieving illumination...
Posts: 412
Re: Help needed when using boost with Visual Studio 2010 Professional

Been a long time since i've used vs and boost, but have you tried adding the boost libs location to your libs path?
gwp is offline   Reply With Quote
Old 07-30-2012, 07:11 AM   #4
journeyman
 
Join Date: Mar 2009
Posts: 264
Re: Help needed when using boost with Visual Studio 2010 Professional

Quote:
Originally Posted by Chips Ahoy View Post
boost does just work out of the box.

1. Are you including the right directory?

On this machine I include C:\Program Files (x86)\boost\boost_1_47

2. Did you install the right stuff? I use the boostpro installer. You need different stuff depending on your CRT settings. Just select them all. Are you doing 32 bit or 64 bit?

3. Simplify your problem. Make a hello world app. Include a boost header. Build.

4. Windows headers can have macros that mess stuff up. There are always workarounds.

What are the #include lines?
#include <boost/functional/hash.hpp>

works for me. I don't know extension.hpp.

It's always better to take something that works and modify it than take something that doesn't and beat your head against the wall.
I decided to rebuild using boostpro installer... I now have the .lib/.dlls saved from this process.

With regards to point 3 -



Am I still doing something wrong?

I have decided to re-extract the header files although I don't see what good this will do but it is worth a shot...

Quote:
Originally Posted by gwp View Post
Been a long time since i've used vs and boost, but have you tried adding the boost libs location to your libs path?
Yeah the boost location was included in the #include path.


As you can see from the image in this post I #include directly to the header file but to no avail? Any help would be so greatly appreciated.

P.S Apologies for not posting over the weekend. Was so frustrated when I made the thread on Friday that I decided to finish for the night and couldn't face it over the weekend.
dontbeleivethehype is offline   Reply With Quote
Old 07-30-2012, 08:05 AM   #5
journeyman
 
Join Date: Mar 2009
Posts: 264
Re: Help needed when using boost with Visual Studio 2010 Professional

Ok so the previous program compiled when including

Code:
 #include <c:/Users/Luke/Downloads/boost_1_50_0 (1)/boost_1_50_0/libs/functional/hash/test/config.hpp>
I am not sure why though? I just looked at a test program distributed with boost but it hasn't yet solved any of my problems from the OP.
dontbeleivethehype is offline   Reply With Quote
Old 07-30-2012, 09:09 AM   #6
grinder
 
iosys's Avatar
 
Join Date: Sep 2011
Location: United States Posts: 9999999
Posts: 531
Re: Help needed when using boost with Visual Studio 2010 Professional

I just skimmed your second to last post and you might be confused of the include and lib path. It's not by just adding #include <x> to your source file but going into visual studio and adding paths to your lib and include path.

I remember installing this awhile back and followed these instructions:
http://stackoverflow.com/questions/2...al-studio-2010

Build the 32-bit libraries

This installs the Boost header files under C:\Boost\include\boost-(version), and the 32-bit libraries under C:\Boost\lib\i386. Note that the default location for the libraries is C:\Boost\lib but you’ll want to put them under an i386 directory if you plan to build for multiple architectures.

Unzip Boost into a new directory.
Start a 32-bit MSVC command prompt and change to the directory where Boost was unzipped.
Run: bootstrap
Run: b2 toolset=msvc --build-type=complete --libdir=C:\Boost\lib\i386 install
Add C:\Boost\include\boost-(version) to your include path.
Add C:\Boost\lib\i386 to your libs path.

Build the 64-bit libraries

This installs the Boost header files under C:\Boost\include\boost-(version), and the 64-bit libraries under C:\Boost\lib\x64. Note that the default location for the libraries is C:\Boost\lib but you’ll want to put them under an x64 directory if you plan to build for multiple architectures.

Unzip Boost into a new directory.
Start a 64-bit MSVC command prompt and change to the directory where Boost was unzipped.
Run: bootstrap
Run: b2 toolset=msvc --build-type=complete --libdir=C:\Boost\lib\x64 architecture=x86 address-model=64 install
Add C:\Boost\include\boost-(version) to your include path.
Add C:\Boost\lib\x64 to your libs path.
iosys is offline   Reply With Quote
Old 07-31-2012, 07:20 PM   #7
gwp
grinder
 
gwp's Avatar
 
Join Date: Jan 2006
Location: Achieving illumination...
Posts: 412
Re: Help needed when using boost with Visual Studio 2010 Professional

What iosys said.

Telling vs where the header files live is not the same as telling it where the lib files live, it needs to know about both.

Additionally, telling vs where the boost header files live means you don't need to use the full path in your code.

Last edited by gwp; 07-31-2012 at 07:26 PM.
gwp is offline   Reply With Quote
Old 08-01-2012, 11:22 AM   #8
journeyman
 
Join Date: Mar 2009
Posts: 264
Re: Help needed when using boost with Visual Studio 2010 Professional

Thanks for the replies. I thought I had built the libraries and linked them properly before, I think it must have failed. So now I have the boost files properly built and linked in visual studio but still running into problems with the third party library.

I have started trying to use the make files for the library although I am having to run them through msys as the linux server I have access to does not allow me enough disk space to have the boost libraries installed on it. I am able to build most of the object files however not the ones I need.... again really frustrating.

Doing it through Visual studio I get a C1073 error.

I am still sooooo stuck. Is there any chance of anyone having a go at building the library for me (I presume that it could be built externally and then uploaded to putlocker or something)? I would love you forever. The specific part of the library I am after is the smartgame library. More specifically the UCT algorithm. My supervisor is currently on holiday for 2 weeks and I can't afford to sit here for the next two weeks being confused.

I can't afford to offer money in return however I am currently attempting to build a database analysis system for poker and would be happy to release the system to people who are helping in this thread when I am finished.... (don't think I can make it open source due to the university owning my work.)

Other than that, I have a meeting with another member of staff at uni (will be starting from scratch with him) tomorrow to attempt to get the problem sorted!

NB: If it is against the rules of this forum to attempt to get people to build for you then I am very sorry in advance. I know it is a bit of a ****ty thing to do but I have limited experience with C++ and could really use some help.
dontbeleivethehype is offline   Reply With Quote
Old 08-01-2012, 05:38 PM   #9
help me help you
 
Chips Ahoy's Avatar
 
Join Date: Apr 2007
Location: up-at-dawn, pride-swallowing siege
Posts: 21,303
Re: Help needed when using boost with Visual Studio 2010 Professional

How are you trying to build this library?

It is gnu style, I don't see MSVC make files / solutions.

In the gnu world, the usual case is

./configure && make && make install

That doesn't work when you want to use visual studio.

Provide more details about what you're trying to do and how you're trying to do it. It seems like you're just posting about where you're stuck and more context is needed.
Chips Ahoy is offline   Reply With Quote
Old 08-02-2012, 12:32 AM   #10
gwp
grinder
 
gwp's Avatar
 
Join Date: Jan 2006
Location: Achieving illumination...
Posts: 412
Re: Help needed when using boost with Visual Studio 2010 Professional

Quite confusing...

Seems you are trying to use libraries built on linux on your widows box with visual studio. This won't work.

You say you don't have enough room on the linux server you have access to. Perhaps you could download virtualbox and install a linux distro such as Salix OS or your distro of choice and do this all locally. Make sure to download the .bz2 or .gz boost distribution file with the unix line endings.

As always the README and INSTALL files will be your friend.
gwp is offline   Reply With Quote
Old 08-02-2012, 12:47 AM   #11
gwp
grinder
 
gwp's Avatar
 
Join Date: Jan 2006
Location: Achieving illumination...
Posts: 412
Re: Help needed when using boost with Visual Studio 2010 Professional

A bit of digging around and I have found these instructions for compiling with vs.
gwp is offline   Reply With Quote
Old 08-02-2012, 12:52 AM   #12
help me help you
 
Chips Ahoy's Avatar
 
Join Date: Apr 2007
Location: up-at-dawn, pride-swallowing siege
Posts: 21,303
Re: Help needed when using boost with Visual Studio 2010 Professional

OP, you aren't very good at asking for help.

There is a page called "Building Fuego with Visual C++".
http://fuego.sourceforge.net/fuego-doc-1.1/index.html

I will now follow its directions to build 32 bit libraries.

Last edited by Chips Ahoy; 08-02-2012 at 12:53 AM. Reason: lol xpost
Chips Ahoy is offline   Reply With Quote
Old 08-02-2012, 01:01 AM   #13
gwp
grinder
 
gwp's Avatar
 
Join Date: Jan 2006
Location: Achieving illumination...
Posts: 412
Re: Help needed when using boost with Visual Studio 2010 Professional

Quote:
Originally Posted by Chips Ahoy View Post
OP, you aren't very good at asking for help.
since i'm linking everything known to man... How To Ask Questions The Smart Way

gwp is offline   Reply With Quote
Old 08-02-2012, 03:37 AM   #14
help me help you
 
Chips Ahoy's Avatar
 
Join Date: Apr 2007
Location: up-at-dawn, pride-swallowing siege
Posts: 21,303
Re: Help needed when using boost with Visual Studio 2010 Professional

Click this and choose file / download
https://docs.google.com/open?id=0B8m...m1yMlZ6RGVqN1E

Making the lib was easy. Testing it was a little tougher.

Here is smartgame as a static lib + the other stuff as a console app that uses it.

Don't build your own boost -- just use the boostpro installer.
Chips Ahoy is offline   Reply With Quote

Reply
      

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 02:50 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright © 2008-2010, Two Plus Two Interactive