Chapter 1, Page 6 - Random1.h

This forum is to discuss the book "C++ design patterns and derivatives pricing."

Chapter 1, Page 6 - Random1.h

Postby quantfinance » Mon Jan 17, 2011 6:59 pm

I am a beginner and using Code::Blocks to compile the code in this book. My first issue in Chapter 1 is that I am receiving an error because of Random1.h - 'No such file or directory'.
I am confused how to change my settings to include this header file as you discuss on page 6?

Do I need to put the code in Listing 1.2 (Random1.h) and Listing 1.3(Random1.cpp) in different files, or do they just go at the bottom of the code in Listing 1.1?

Thanks for your help.
quantfinance
 
Posts: 22
Joined: Sun Nov 14, 2010 2:44 pm

Re: Chapter 1, Page 6 - Random1.h

Postby mj » Mon Jan 17, 2011 10:58 pm

you should not merge files.

You need to create a project and put all the relevant cpp files in it.

You also need to figure out how to specify include directories using code::blocks. It is not one of my standard applications so i don't know how to do it.
mj
Site Admin
 
Posts: 1273
Joined: Fri Jul 27, 2007 7:21 am

Re: Chapter 1, Page 6 - Random1.h

Postby quantfinance » Mon Jan 17, 2011 11:52 pm

Thank you so much for your help.

So Listing 1.2 and 1.3 should both be seperate .cpp files?

Do you know what type of project I need to create - there are 20+ categories such as (ARM, AVR, Direct/X, GTK+, Matlab, Code::Blocks Plugin, SDL, etc. etc.)

What compiler do you reccomend as I am fine with switching from Code::Blocks?

Thank you.
quantfinance
 
Posts: 22
Joined: Sun Nov 14, 2010 2:44 pm

Re: Chapter 1, Page 6 - Random1.h

Postby mj » Tue Jan 18, 2011 12:02 am

each main program file has a list of required files. Your project should contain these.

The usual solution is to use Visual Studio 9 or 10 with a console application.

The express versions are free for everyone. The professional versions are free for students via the Dreamspark program.
mj
Site Admin
 
Posts: 1273
Joined: Fri Jul 27, 2007 7:21 am

Re: Chapter 1, Page 6 - Random1.h

Postby quantfinance » Fri Jan 21, 2011 11:55 pm

Thank you for your help. I am now on VS 2010, however, there are some changes to the settings from previous VS versions and you can no longer change the Include Directory in the Tools - Options.
http://blogs.msdn.com/b/vsproject/archive/2009/07/07/vc-directories.aspx

So to change the directory, I went to the Property Mgr, and selected the properties. Under Config Properties I selected VC++ Directories and went to Edit the 'Include Directories'. However, what path do I edit this to? In the book it says C/include? I am not sure what that means. I tried a couple different paths and none of them worked.

Your help would be GREATLY appreciated.
Thanks.
quantfinance
 
Posts: 22
Joined: Sun Nov 14, 2010 2:44 pm

Re: Chapter 1, Page 6 - Random1.h

Postby mj » Sat Jan 22, 2011 6:28 am

just put the complete name of the directory which has the include files in it.
mj
Site Admin
 
Posts: 1273
Joined: Fri Jul 27, 2007 7:21 am

Re: Chapter 1, Page 6 - Random1.h

Postby quantfinance » Sat Jan 22, 2011 2:07 pm

I am sorry for my beginner questions but I am so confused and have been trying everything to get this to work.
These are the errors I am getting:
1> SimpleMCMain1.cpp
1>c:\documents and settings\administrator\my documents\visual studio 2010\projects\monte carlo - joshi book p. 3\monte carlo - joshi book p. 3\simplemcmain1.cpp(3): fatal error C1083: Cannot open include file: 'Random1.h': No such file or directory
1> Random1.cpp
1>c:\documents and settings\administrator\my documents\visual studio 2010\projects\monte carlo - joshi book p. 3\monte carlo - joshi book p. 3\random1.cpp(1): fatal error C1083: Cannot open include file: 'Random1.h': No such file or directory

I have tried to change the Include directory. I changed it to:
C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Monte Carlo - Joshi Book P.3\Monte Carlo - Joshi Book P.3\Debug

I also tried changing it to:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl

I also tried using both of them at the same time, however neither of these methods worked. Please advise on what NAME of the directory I should be using as I am very confused?

When I changed <Random1.h> to "Random1.h" , I was able to build the solution successfully so I know the code is correct. However, I would like to solve correctly with <Random1.h> as you have intended.

Thank you so much for your time and help.
quantfinance
 
Posts: 22
Joined: Sun Nov 14, 2010 2:44 pm

Re: Chapter 1, Page 6 - Random1.h

Postby mj » Sat Jan 22, 2011 8:55 pm

you have to use the complete name of the folder that has random1.h in it.
mj
Site Admin
 
Posts: 1273
Joined: Fri Jul 27, 2007 7:21 am


Return to C++ design patterns and derivatives pricing

Who is online

Users browsing this forum: No registered users and 0 guests

cron