-1

i'm a c# developer, have no experience on c++. I'm trying to create a c++ console application from this code:

http://www.oblita.com/interception.html

i downloaded the sources and registerd with install-interception.exe

in visual studio 2015 i created a new console application and added interception.h under Header Files.

in ConsoleApplication1.cpp added this code:

#include "stdafx.h"
#include <iostream>
#include <interception.h>
#include "utils.h"
using namespace std;

int main()
{
 return 0;
}

when building i get this error:

Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'interception.h': No such file or directory ConsoleApplication1 d:\documenti\visual studio 2015\projects\c++\consoleapplication1\consoleapplication1\consoleapplication1.cpp 6

vs error

NathanOliver
  • 171,901
  • 28
  • 288
  • 402
FDB
  • 971
  • 16
  • 32
  • 2
    Well, the error says it all. Which part of it do you not understand? – Biffen Mar 13 '17 at 15:44
  • 7
    Try `#include "interception.h"` instead of `#include ` – yeputons Mar 13 '17 at 15:45
  • 3
    It's better to include text of error instead of image – alexeykuzmin0 Mar 13 '17 at 15:46
  • 3
    Not related to your problem, but [don't get in the habit of using `using namespace std;`](http://stackoverflow.com/q/1452721/10077). – Fred Larson Mar 13 '17 at 15:47
  • It seems that interception is a package you have to "install", after which it apparently adds includes like "interception.h" to visual studio. Also, when creating a console application, you may want to create an "empty project" to avoid precompiled headers and the "stdafx.h" stuff. After you create an empty project, you can then "add existing item" to the project to add a source file to the project. – rcgldr Mar 13 '17 at 15:48
  • 2
    The path to `interception.h` is probably not configured properly for your project. I've had a variety of hit-or-miss scenarios with various packages trying to automatically configure your include directories. The screens we really need to see to help you out are the global include paths and the project include paths. I would recommend you check out this other answer about include paths. Not a duplicate, but probably extremely helpful. [Include Paths Visual Studio](http://stackoverflow.com/questions/2676417/how-do-include-paths-work-in-visual-studio) – Kevin K Mar 13 '17 at 15:54
  • i dont need to understand the error message, i need to understand how to make the program building, thanks. – FDB Mar 13 '17 at 16:02
  • @FDB What if I told you they're the same thing? – Biffen Mar 13 '17 at 16:20
  • 3
    "i dont need to understand the error message" ... I am not sure if this is the right approach ;) – 463035818_is_not_an_ai Mar 13 '17 at 16:24
  • @yeputons same error – FDB Mar 13 '17 at 16:34
  • why cannot open interceptor.h if i added it under Header Files? – FDB Mar 13 '17 at 16:45
  • @FDB Adding a header file to a project and telling the compiler where to look for header files are two different things. Any introductory Visual Studio tutorial would cover how to do the latter. – Biffen Mar 13 '17 at 16:54
  • good news, i added interception.h path in project->properties->C/C++->Additional Include Directories, now it builds – FDB Mar 14 '17 at 09:19

1 Answers1

0

To paraphrase @Biffen:

Adding a header file to a project and telling the compiler where to look for header files are two different things.

MSDN describes how to do tell the compiler to look for the header file:

To set this compiler option in the Visual Studio development environment

  • Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.
  • Click the C/C++ folder.
  • Click the General property page.
  • Modify the Additional Include Directories property.
Community
  • 1
  • 1
Kevin K
  • 408
  • 2
  • 18
  • I'm adding this answer as a way to mark this item as resolved and for helping other people in the future. I'm not trying to claim sole credit (@Biffen should probably get it), but this would be a useful answer to Visual Studio users who don't have the time to read and understand an error message. – Kevin K Mar 15 '17 at 13:38