[skip all navigation]

Using Boost in Visual Studio 2010, help me solve my noob C++ problems

Creator: JaFF
Time: Jan 31 2012, 7:14 pm

Post #1     JaFF Jan 31 2012, 7:14 pm

[Avatar]
offlinecontact
Rank: Elite
I'm a noob programmer when it comes to serious business such as C++, but I have to use it for my university project. I must use Visual Studio 2010 because that's what my department has as the "departmental software". My personal drive is H which can be accessed from any university computer under my account. I need to use Boost for its random number generators, so I download it and unzip it into my H drive. Then I go and read this manual that explains how to connect your project and the boost library.
Quote
1. Unarchive the latest version of boost (1.47.0 as of writing) into a directory of your choice (e.g. C:\boost_1_47_0).
2. Create a new empty project in Visual Studio.
3. Open the Property Manager and expand one of the configuration for the platform of your choice.
4. Select & right click Microsoft.Cpp.<Platform>.user, and select Properties to open the Property Page for edit.
5. Select VC++ Directories on the left.
6. Edit the Include Directories section to include the path to your boost source files.
7. Repeat steps 3 - 6 for different platform of your choice if needed.
Although what I see is a little bit different to what the person describes, I got to the menu he is talking about in step 6 with "Include Directories". When clicking the "..." to browse directories I cannot see my H drive, I only see the default C and D drives. Naturally I just enter the directory manually and it doesn't seem to reject it. Now what? I type in "#include <boost>" but it does not compile and it is underlined with red in my code editor - it is seeing an obvious error.

So I guess my question is of two parts:
1. Why does it not recognise my H drive (as well as all the other remote university drives) and is it a problem?
2. Once I get it to recognise the Boost library (if I haven't done it correctly so far), what is the correct method of using the "random" part of Boost in my code?

Note: I cannot put the Boost folder into the C drive because of space restrictions.

Thanks. :)

Top

Post #2     Lanthanide Jan 31 2012, 8:04 pm

[Avatar]
offlinecontact
Rank: Regular
If this is a university assignment, and you're tasked with using boost, why don't you ask the course supervisor/whoever how to fix the issue? Surely other people are going to have the same problem.

O)FaRTy1billion -- "Lanthanide -- surely you have photos of yourself dressed up as a girl, az?" I don't have pictures of me dressed up as a girl.
O)FaRTy1billion -- One time I was jumping on a trampoline (at that very friend's house xD) with water balloons in my shirt held up by a belt.
Azrael.Wrath -- ...
Top

Post #3     CecilSunkure Jan 31 2012, 8:48 pm

[Avatar]
offlinecontact
Rank: Veteran
You have to use Boost? Or you need random numbers? You can get your own random numbers: http://cecilsunkure.blogspot.com/search/label/PRNG

You can add Boost to your system path. You can also place it somewhere else other than the H drive so that the linker can find it properly.

(user posted image)
Top

Post #4     Lanthanide Jan 31 2012, 9:25 pm

[Avatar]
offlinecontact
Rank: Regular
rand() is actually very bad if you want to use it for any serious purpose.

http://www.azillionmonkeys.com/qed/random.html
This post was edited 1 time, last edit by Lanthanide: Jan 31 2012, 9:32 pm.

O)FaRTy1billion -- "Lanthanide -- surely you have photos of yourself dressed up as a girl, az?" I don't have pictures of me dressed up as a girl.
O)FaRTy1billion -- One time I was jumping on a trampoline (at that very friend's house xD) with water balloons in my shirt held up by a belt.
Azrael.Wrath -- ...
Top

Post #5     HCM™Aristocrat Jan 31 2012, 9:32 pm

[Avatar]
✁ - - - - - - - - -
offlinecontact
Rank: Regular
Quote from Lanthanide
rand() is actually very bad if you want to use it for any serious purpose

Why? Pseudorandom numbers are statistically indistinguishable from true randomness.

(user posted image)
Top

Post #6     Lanthanide Jan 31 2012, 9:35 pm

[Avatar]
offlinecontact
Rank: Regular
Quote from HCM™Aristocrat
Why? Pseudorandom numbers are statistically indistinguishable from true randomness.
If you have a good statistically sound PRNG then yes, of course. If your PRNG is not statistically sound, then no.

rand() is implementation dependant: it depends on your compiler/libraries. Most implementations these days are probably ok to use, but in the 80s and 90s that was not necessarily the case - you could take your program that used rand() and compile it with a bad compiler and end up with a program that doesn't operate properly because it is relying on the bad rand() function. Follow the link for more discussion on rand and its pitfalls.

In general, C only provides very basic library and general purpose functionality. In a lot of cases you'll have to roll your own (or acquire from a 3rd party) better functions to handle a lot of stuff.

O)FaRTy1billion -- "Lanthanide -- surely you have photos of yourself dressed up as a girl, az?" I don't have pictures of me dressed up as a girl.
O)FaRTy1billion -- One time I was jumping on a trampoline (at that very friend's house xD) with water balloons in my shirt held up by a belt.
Azrael.Wrath -- ...
Top

Post #7     JaFF Jan 31 2012, 10:42 pm

[Avatar]
offlinecontact
Rank: Elite
Quote from Lanthanide
If this is a university assignment, and you're tasked with using boost, why don't you ask the course supervisor/whoever how to fix the issue? Surely other people are going to have the same problem.
This is a final year project, so it's up to me to pick what means I use to obtain results. This isn't a programming course and my supervisor isn't a programmer.
Quote from CecilSunkure
You have to use Boost? Or you need random numbers? You can get your own random numbers: http://cecilsunkure.blogspot.com/search/label/PRNG

You can add Boost to your system path. You can also place it somewhere else other than the H drive so that the linker can find it properly.
I need a wide range of distributions to be available for a very computation-heavy task. Getting the uniform and the exponential distributions is easy but others are quite messy and I suspect would be much faster if taken from a library written by people who are actually good at programming. :P

What do you mean by "adding Boost to my system path?" I can't place it anywhere else because of file size restrictions - I have huge space available on my H drive but virtually none on any other drive so the Boost folder doesn't fit into C drive.

Top

Post #8     ShadowFlare Jan 31 2012, 11:07 pm

[Avatar]
offlinecontact
Rank: Veteran
Try making a shortcut to the folder and checking the shortcut's properties to find the path to make sure it is what you think it is or if it is something else.

Top

Post #9     Lanthanide Jan 31 2012, 11:51 pm

[Avatar]
offlinecontact
Rank: Regular
Quote from JaFF
This isn't a programming course and my supervisor isn't a programmer.
All the more reason that there should be someone at the university you can ask for help, either in the CS department or the IT department (they are not the same thing, generally).

O)FaRTy1billion -- "Lanthanide -- surely you have photos of yourself dressed up as a girl, az?" I don't have pictures of me dressed up as a girl.
O)FaRTy1billion -- One time I was jumping on a trampoline (at that very friend's house xD) with water balloons in my shirt held up by a belt.
Azrael.Wrath -- ...
Top
0 members in this topic (italic members are currently writing a reply): None
+ guest(s)


[10:46 pm]
Sacrieur -- lol
[10:46 pm]
Sacrieur -- oh tempz
[10:30 pm]
OlimarandLouie -- So shoutbox, hows it hangin'?
[09:12 pm]
Sacrieur -- au revoir
[09:10 pm]
Azrael -- Night :kame:
[09:10 pm]
Sacrieur -- PARIS TEH CITY OF ZE LOVES
[09:10 pm]
Azrael -- Thanks for maintaining the infos ^^ I'll try to find another hotspot when I hit Paris.
Please log in to shout.