0

The path to my .cpp and .h files: /home/quasiturbine/ServerProject/Network/NetworkIncludes/

There you can find TCP_Connexion.h and TCP_Connexion.cpp

In the .cpp file, I got #include "NetworkIncludes\TCP_Connexion.h" and default constructor/destructor. That's it.

G++ command:

g++ -o program -I/home/quasiturbine/ServerProject/Network/ /home/quasiturbine/ServerProject/Network/NetworkIncludes/TCP_Connexion.cpp 

fatal error: /home/quasiturbine/ServerProject/Network/NetworkIncludes/TCP_Connexion.cpp:1:43: fatal error: NetworkIncludes\TCP_Connexion.h: No such file or folder #include "NetworkIncludes\TCP_Connexion.h"

What is wrong and how can I fix it?

6
  • I think you want to add you Project Folder as include Directory. With gcc/g++ you Need to add the following flag: -I/home/quasiturbine/ServerProject/Network/ Commented Nov 20, 2017 at 9:42
  • My I look like an L but it's an i Commented Nov 20, 2017 at 9:44
  • try to use #include <NetworkIncludes\TCP_Connexion.h> instead of #include "NetworkIncludes\TCP_Connexion.h" Commented Nov 20, 2017 at 9:45
  • I dont know if I was clear...after program, it's in Include, not a link Commented Nov 20, 2017 at 9:45
  • I tried with brackets <> and coma "" Commented Nov 20, 2017 at 9:46

1 Answer 1

6

The problem is, that you are using backslashes \ when you should be using forward slashes /. Backslashes in include paths are undefined behavior before C++11 and implementation defined afterwards (reference).

So change your include to

#include "NetworkIncludes/TCP_Connexion.h" 

and you should be good to go.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.