<p>No MakeFile or Visual Studio Solution file is provided. So you will need to do the setup yourself in the Visual Studio IDE. Note that you could just drag and drop the files (.h and .cc are known extensions to Visual Studio) in a new console application if you are not/less familiar with Visual Studio.</p>

<p>The code itself is just plain C++ code. No special stuff. So it does not matter which platform or IDE was used during development. In fact the code is pretty self containing except for</p>

<pre><code>#include &lt;math.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;iostream&gt;
#include "float.h" -&gt; &lt;float.h&gt;
</code></pre>

<p>But if your Visual Studio is installed and configured correctly, every <strong>console</strong> application can just include these headers without any problems. (Just try a basic <code>hello world</code> <strong>console</strong> application, since the problem has in my opinion nothing to do with the code you want to use.) Note that you need a <strong>Win32 Console application</strong> and NOT a <strong>Win32 Project</strong>.</p>

<p>It could be possible that the pre-compiled header file is enabled (<code>StdAfx.h</code> or <code>pch.h</code>) in which case you could disable this or include the header as the first included header in every <code>.cpp</code> file.</p>

CC BY-SA 3.0
2017-02-26T12:12:36.847Z
Thanks! So your saying I need to create a Win32 Console Application -> Import all Files and I should be good to go?
Arjan Singh
CC BY-SA 3.0
2017-02-26T12:43:27.577Z
Try this first: https://msdn.microsoft.com/en-us/library/jj620919.aspx Then drag and drop your files and your main function instead. (And remember what I said about Precompiled Headers)
Matthias
CC BY-SA 3.0
2017-02-26T11:19:21.013Z
2017-02-26T11:19:21.013Z
Matthias
<p>Right now I am reading Peter Shirley's <a href="http://rads.stackoverflow.com/amzn/click/B01B5AODD8" rel="nofollow noreferrer">Ray Tracing in One Weekend</a> book, I want to be able to use the provided <a href="https://github.com/petershirley/raytracinginoneweekend" rel="nofollow noreferrer">source code</a> but I am not sure what platform or IDE it was written on, because of this it does not compile in Visual Studio.</p>

<p>Can somebody help me? Whenever I try compiling the code it asks me to 'attach to process'.</p>

<p>How can I get this working? In a few reviews I have read online it says that I'll need to do some tweaking to get it working but I honestly don't know how.
Would it mean rewriting the entire ray tracer as a Win32 Project? </p>

<raytracing>
How to get Ray Tracer working in Visual Studio
Arjan Singh
# How to get Ray Tracer working in Visual Studio

(Asked by: username_0 on 2017-02-26)

Right now I am reading Peter Shirley's [Ray Tracing in One Weekend](http://rads.stackoverflow.com/amzn/click/B01B5AODD8) book, I want to be able to use the provided [source code](https://github.com/petershirley/raytracinginoneweekend) but I am not sure what platform or IDE it was written on, because of this it does not compile in Visual Studio.

Can somebody help me? Whenever I try compiling the code it asks me to 'attach to process'.

How can I get this working? In a few reviews I have read online it says that I'll need to do some tweaking to get it working but I honestly don't know how.
Would it mean rewriting the entire ray tracer as a Win32 Project?

**Tags:** raytracing


---

## 1 answers

### Answer by username_1 on 2017-02-26. Score: 3 | Accepted answer

No MakeFile or Visual Studio Solution file is provided. So you will need to do the setup yourself in the Visual Studio IDE. Note that you could just drag and drop the files (.h and .cc are known extensions to Visual Studio) in a new console application if you are not/less familiar with Visual Studio.

The code itself is just plain C++ code. No special stuff. So it does not matter which platform or IDE was used during development. In fact the code is pretty self containing except for

```
#include <math.h>
#include <stdlib.h>
#include <iostream>
#include "float.h" -> <float.h>

```

But if your Visual Studio is installed and configured correctly, every **console** application can just include these headers without any problems. (Just try a basic `hello world` **console** application, since the problem has in my opinion nothing to do with the code you want to use.) Note that you need a **Win32 Console application** and NOT a **Win32 Project**.

It could be possible that the pre-compiled header file is enabled (`StdAfx.h` or `pch.h`) in which case you could disable this or include the header as the first included header in every `.cpp` file.

> **Comments:**
> **username_0**: Thanks! So your saying I need to create a Win32 Console Application -> Import all Files and I should be good to go?  
> **username_1**: Try this first: https://msdn.microsoft.com/en-us/library/jj620919.aspx Then drag and drop your files and your main function instead. (And remember what I said about Precompiled Headers)  

---

