1
$\begingroup$

Right now I am reading Peter Shirley's Ray Tracing in One Weekend book, I want to be able to use the provided source code 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?

$\endgroup$
3
$\begingroup$

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.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks! So your saying I need to create a Win32 Console Application -> Import all Files and I should be good to go? $\endgroup$ – Arjan Singh Feb 26 '17 at 12:12
  • $\begingroup$ Try this first: 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) $\endgroup$ – Matthias Feb 26 '17 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.