.h file cannot see another in the same folder C++ EclipseCan I call a constructor from another constructor (do constructor chaining) in C++?How do I include a JavaScript file in another JavaScript file?C++ code file extension? .cc vs .cppC++: hashtable - Why won't this compile?Read file line by line using ifstream in C++Include another HTML file in a HTML fileCan't compile basic C++ program with TBB and lambdaWhy can I not call reserve on a vector of const elements?Why can I not std::partition this std::unordered_map?SFML ERROR I know you know something about it
Can I shorten this filter, that finds disk sizes over 100G?
Can living where Rare Earth magnetic ore is abundant provide any protection from cosmic radiation?
Best Ergonomic Design for a handheld ranged weapon
Correct word for a little toy that always stands up?
How would a lunar colony attack Earth?
Derivative is just speed of change?
How did Biff return to 2015 from 1955 without a lightning strike?
Just how much information should you share with a former client?
Move arrows along a contour
What to expect in a jazz audition
Does Ubuntu reduce battery life?
In the Schrödinger equation, can I have a Hamiltonian without a kinetic term?
When did J.K. Rowling decide to make Ron and Hermione a couple?
Why is Searing Smite not listed in the Roll20 Spell books?
Can starter be used as an alternator?
Create and use Object Variable
What are these hats and the function of those wearing them? worn by the Russian imperial army at Borodino
Best practice for keeping temperature constant during film development at home
If I buy and download a game through second Nintendo account do I own it on my main account too?
Can machine learning learn a function like finding maximum from a list?
Why is “deal 6 damage” a legit phrase?
How to get Planck length in meters to 6 decimal places
Balancing Humanoid fantasy races: Elves
What force enables us to walk? Friction or normal reaction?
.h file cannot see another in the same folder C++ Eclipse
Can I call a constructor from another constructor (do constructor chaining) in C++?How do I include a JavaScript file in another JavaScript file?C++ code file extension? .cc vs .cppC++: hashtable - Why won't this compile?Read file line by line using ifstream in C++Include another HTML file in a HTML fileCan't compile basic C++ program with TBB and lambdaWhy can I not call reserve on a vector of const elements?Why can I not std::partition this std::unordered_map?SFML ERROR I know you know something about it
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
The weird thing about this problem is that other .cpp and .h files can find the file but not this one, they're all in the SAME folder. My file structure is as follows:
/Entity.h // is being included
/Graphics.cpp // can include
/Graphics.h // CANNOT include
/main.cpp // can include
/Physics.cpp // can include
/Physics.h // can include
Graphics.cpp, main.cpp, Physics.cpp, Physics.h are all able to include Entity.h but Graphics.h cannot.
This is Entity.h
#ifndef ENTITY_H
#define ENTITY_H
#include <vector>
#include <SFML/Graphics.hpp>
using namespace std;
struct entity
int ID;
vector<long double> position;
vector<long double> velocity;
vector<long double> acceleration;
sf::Color colour;
sf::CircleShape selfImage;
long double mass;
;
entity createEntity(long double x, long double y, long double xV, long double yV, long double m, int newID)
entity e;
// assign entity ID and increment entity ID count
e.ID = newID;
// initialise velocity, acceleration & position to 0
e.position.resize(2, 0);
e.velocity.resize(2, 0);
e.acceleration.resize(2, 0);
e.position = x, y;
e.velocity = xV, yV;
// setup self-image
e.colour = sf::Color (255, 0, 0);
e.selfImage.setFillColor(e.colour);
// initialise mass
e.mass = m;
return e;
;
#endif // ENTITY_H
This is Graphics.h
/*
* Graphics.h
*
* Created on: 26 Mar 2019
* Author: chris
*/
#ifndef GRAPHICS_H_
#define GRAPHICS_H_
#include <SFML/Graphics.hpp>
#include <vector>
#include <Entity.h>
class Graphics
public:
Graphics(int WIDTH, int HEIGHT);
~Graphics();
void update(vector<entity> entities);
int W_WIDTH;
int W_HEIGHT;
sf::RenderWindow window;
;
#endif /* GRAPHICS_H_ */
Physics.h, an example of something which can include Entity.h
#ifndef PHYSICS_H
#define PHYSICS_H
#include <Entity.h>
#include <vector>
using namespace std;
class Physics
long double G_CONST = 0.00000000006674;
public:
Physics();
virtual ~Physics();
const int MAP_WIDTH = 1000;
const int MAP_HEIGHT = 1000;
vector<vector<entity*>> gameMap;
vector<entity> entityList;
void addEntity(entity e);
int update();
protected:
private:
;
#endif // PHYSICS_H
The console output is the following
make all
Building file: ../Graphics.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Graphics.d" -MT"Graphics.o" -o "Graphics.o" "../Graphics.cpp"
In file included from ../Graphics.cpp:7:
../Graphics.h:12:10: fatal error: ./Entity.h: No such file or directory
#include <./Entity.h>
^~~~~~~~~~~~
compilation terminated.
make: *** [subdir.mk:26: Graphics.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
I am using Eclipse on Debian. This has me puzzled, I cannot see a difference in the files.
EDIT:
using "" instead of <> around the include statements file name fixed the problem. Other problems have ensued however :((((((
c++ header include eclipse-cdt
|
show 6 more comments
The weird thing about this problem is that other .cpp and .h files can find the file but not this one, they're all in the SAME folder. My file structure is as follows:
/Entity.h // is being included
/Graphics.cpp // can include
/Graphics.h // CANNOT include
/main.cpp // can include
/Physics.cpp // can include
/Physics.h // can include
Graphics.cpp, main.cpp, Physics.cpp, Physics.h are all able to include Entity.h but Graphics.h cannot.
This is Entity.h
#ifndef ENTITY_H
#define ENTITY_H
#include <vector>
#include <SFML/Graphics.hpp>
using namespace std;
struct entity
int ID;
vector<long double> position;
vector<long double> velocity;
vector<long double> acceleration;
sf::Color colour;
sf::CircleShape selfImage;
long double mass;
;
entity createEntity(long double x, long double y, long double xV, long double yV, long double m, int newID)
entity e;
// assign entity ID and increment entity ID count
e.ID = newID;
// initialise velocity, acceleration & position to 0
e.position.resize(2, 0);
e.velocity.resize(2, 0);
e.acceleration.resize(2, 0);
e.position = x, y;
e.velocity = xV, yV;
// setup self-image
e.colour = sf::Color (255, 0, 0);
e.selfImage.setFillColor(e.colour);
// initialise mass
e.mass = m;
return e;
;
#endif // ENTITY_H
This is Graphics.h
/*
* Graphics.h
*
* Created on: 26 Mar 2019
* Author: chris
*/
#ifndef GRAPHICS_H_
#define GRAPHICS_H_
#include <SFML/Graphics.hpp>
#include <vector>
#include <Entity.h>
class Graphics
public:
Graphics(int WIDTH, int HEIGHT);
~Graphics();
void update(vector<entity> entities);
int W_WIDTH;
int W_HEIGHT;
sf::RenderWindow window;
;
#endif /* GRAPHICS_H_ */
Physics.h, an example of something which can include Entity.h
#ifndef PHYSICS_H
#define PHYSICS_H
#include <Entity.h>
#include <vector>
using namespace std;
class Physics
long double G_CONST = 0.00000000006674;
public:
Physics();
virtual ~Physics();
const int MAP_WIDTH = 1000;
const int MAP_HEIGHT = 1000;
vector<vector<entity*>> gameMap;
vector<entity> entityList;
void addEntity(entity e);
int update();
protected:
private:
;
#endif // PHYSICS_H
The console output is the following
make all
Building file: ../Graphics.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Graphics.d" -MT"Graphics.o" -o "Graphics.o" "../Graphics.cpp"
In file included from ../Graphics.cpp:7:
../Graphics.h:12:10: fatal error: ./Entity.h: No such file or directory
#include <./Entity.h>
^~~~~~~~~~~~
compilation terminated.
make: *** [subdir.mk:26: Graphics.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
I am using Eclipse on Debian. This has me puzzled, I cannot see a difference in the files.
EDIT:
using "" instead of <> around the include statements file name fixed the problem. Other problems have ensued however :((((((
c++ header include eclipse-cdt
Have you changed your include path?
– immibis
Mar 26 at 22:36
nope, i’ve just created a CDT project in Eclipse and away I went. I did add SFML’s include folder to /usr/include but apart from that, no
– AshKetchupp
Mar 26 at 23:03
I would try without the./
beforeEntity.h
– drescherjm
Mar 26 at 23:06
Maybe you have more than 1Graphics.h
files that are in different folders.
– drescherjm
Mar 26 at 23:07
How did you include Graphics.h? Using <> or "" ?
– immibis
Mar 27 at 0:50
|
show 6 more comments
The weird thing about this problem is that other .cpp and .h files can find the file but not this one, they're all in the SAME folder. My file structure is as follows:
/Entity.h // is being included
/Graphics.cpp // can include
/Graphics.h // CANNOT include
/main.cpp // can include
/Physics.cpp // can include
/Physics.h // can include
Graphics.cpp, main.cpp, Physics.cpp, Physics.h are all able to include Entity.h but Graphics.h cannot.
This is Entity.h
#ifndef ENTITY_H
#define ENTITY_H
#include <vector>
#include <SFML/Graphics.hpp>
using namespace std;
struct entity
int ID;
vector<long double> position;
vector<long double> velocity;
vector<long double> acceleration;
sf::Color colour;
sf::CircleShape selfImage;
long double mass;
;
entity createEntity(long double x, long double y, long double xV, long double yV, long double m, int newID)
entity e;
// assign entity ID and increment entity ID count
e.ID = newID;
// initialise velocity, acceleration & position to 0
e.position.resize(2, 0);
e.velocity.resize(2, 0);
e.acceleration.resize(2, 0);
e.position = x, y;
e.velocity = xV, yV;
// setup self-image
e.colour = sf::Color (255, 0, 0);
e.selfImage.setFillColor(e.colour);
// initialise mass
e.mass = m;
return e;
;
#endif // ENTITY_H
This is Graphics.h
/*
* Graphics.h
*
* Created on: 26 Mar 2019
* Author: chris
*/
#ifndef GRAPHICS_H_
#define GRAPHICS_H_
#include <SFML/Graphics.hpp>
#include <vector>
#include <Entity.h>
class Graphics
public:
Graphics(int WIDTH, int HEIGHT);
~Graphics();
void update(vector<entity> entities);
int W_WIDTH;
int W_HEIGHT;
sf::RenderWindow window;
;
#endif /* GRAPHICS_H_ */
Physics.h, an example of something which can include Entity.h
#ifndef PHYSICS_H
#define PHYSICS_H
#include <Entity.h>
#include <vector>
using namespace std;
class Physics
long double G_CONST = 0.00000000006674;
public:
Physics();
virtual ~Physics();
const int MAP_WIDTH = 1000;
const int MAP_HEIGHT = 1000;
vector<vector<entity*>> gameMap;
vector<entity> entityList;
void addEntity(entity e);
int update();
protected:
private:
;
#endif // PHYSICS_H
The console output is the following
make all
Building file: ../Graphics.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Graphics.d" -MT"Graphics.o" -o "Graphics.o" "../Graphics.cpp"
In file included from ../Graphics.cpp:7:
../Graphics.h:12:10: fatal error: ./Entity.h: No such file or directory
#include <./Entity.h>
^~~~~~~~~~~~
compilation terminated.
make: *** [subdir.mk:26: Graphics.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
I am using Eclipse on Debian. This has me puzzled, I cannot see a difference in the files.
EDIT:
using "" instead of <> around the include statements file name fixed the problem. Other problems have ensued however :((((((
c++ header include eclipse-cdt
The weird thing about this problem is that other .cpp and .h files can find the file but not this one, they're all in the SAME folder. My file structure is as follows:
/Entity.h // is being included
/Graphics.cpp // can include
/Graphics.h // CANNOT include
/main.cpp // can include
/Physics.cpp // can include
/Physics.h // can include
Graphics.cpp, main.cpp, Physics.cpp, Physics.h are all able to include Entity.h but Graphics.h cannot.
This is Entity.h
#ifndef ENTITY_H
#define ENTITY_H
#include <vector>
#include <SFML/Graphics.hpp>
using namespace std;
struct entity
int ID;
vector<long double> position;
vector<long double> velocity;
vector<long double> acceleration;
sf::Color colour;
sf::CircleShape selfImage;
long double mass;
;
entity createEntity(long double x, long double y, long double xV, long double yV, long double m, int newID)
entity e;
// assign entity ID and increment entity ID count
e.ID = newID;
// initialise velocity, acceleration & position to 0
e.position.resize(2, 0);
e.velocity.resize(2, 0);
e.acceleration.resize(2, 0);
e.position = x, y;
e.velocity = xV, yV;
// setup self-image
e.colour = sf::Color (255, 0, 0);
e.selfImage.setFillColor(e.colour);
// initialise mass
e.mass = m;
return e;
;
#endif // ENTITY_H
This is Graphics.h
/*
* Graphics.h
*
* Created on: 26 Mar 2019
* Author: chris
*/
#ifndef GRAPHICS_H_
#define GRAPHICS_H_
#include <SFML/Graphics.hpp>
#include <vector>
#include <Entity.h>
class Graphics
public:
Graphics(int WIDTH, int HEIGHT);
~Graphics();
void update(vector<entity> entities);
int W_WIDTH;
int W_HEIGHT;
sf::RenderWindow window;
;
#endif /* GRAPHICS_H_ */
Physics.h, an example of something which can include Entity.h
#ifndef PHYSICS_H
#define PHYSICS_H
#include <Entity.h>
#include <vector>
using namespace std;
class Physics
long double G_CONST = 0.00000000006674;
public:
Physics();
virtual ~Physics();
const int MAP_WIDTH = 1000;
const int MAP_HEIGHT = 1000;
vector<vector<entity*>> gameMap;
vector<entity> entityList;
void addEntity(entity e);
int update();
protected:
private:
;
#endif // PHYSICS_H
The console output is the following
make all
Building file: ../Graphics.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Graphics.d" -MT"Graphics.o" -o "Graphics.o" "../Graphics.cpp"
In file included from ../Graphics.cpp:7:
../Graphics.h:12:10: fatal error: ./Entity.h: No such file or directory
#include <./Entity.h>
^~~~~~~~~~~~
compilation terminated.
make: *** [subdir.mk:26: Graphics.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
I am using Eclipse on Debian. This has me puzzled, I cannot see a difference in the files.
EDIT:
using "" instead of <> around the include statements file name fixed the problem. Other problems have ensued however :((((((
c++ header include eclipse-cdt
c++ header include eclipse-cdt
edited Mar 27 at 16:37
AshKetchupp
asked Mar 26 at 22:32
AshKetchuppAshKetchupp
63 bronze badges
63 bronze badges
Have you changed your include path?
– immibis
Mar 26 at 22:36
nope, i’ve just created a CDT project in Eclipse and away I went. I did add SFML’s include folder to /usr/include but apart from that, no
– AshKetchupp
Mar 26 at 23:03
I would try without the./
beforeEntity.h
– drescherjm
Mar 26 at 23:06
Maybe you have more than 1Graphics.h
files that are in different folders.
– drescherjm
Mar 26 at 23:07
How did you include Graphics.h? Using <> or "" ?
– immibis
Mar 27 at 0:50
|
show 6 more comments
Have you changed your include path?
– immibis
Mar 26 at 22:36
nope, i’ve just created a CDT project in Eclipse and away I went. I did add SFML’s include folder to /usr/include but apart from that, no
– AshKetchupp
Mar 26 at 23:03
I would try without the./
beforeEntity.h
– drescherjm
Mar 26 at 23:06
Maybe you have more than 1Graphics.h
files that are in different folders.
– drescherjm
Mar 26 at 23:07
How did you include Graphics.h? Using <> or "" ?
– immibis
Mar 27 at 0:50
Have you changed your include path?
– immibis
Mar 26 at 22:36
Have you changed your include path?
– immibis
Mar 26 at 22:36
nope, i’ve just created a CDT project in Eclipse and away I went. I did add SFML’s include folder to /usr/include but apart from that, no
– AshKetchupp
Mar 26 at 23:03
nope, i’ve just created a CDT project in Eclipse and away I went. I did add SFML’s include folder to /usr/include but apart from that, no
– AshKetchupp
Mar 26 at 23:03
I would try without the
./
before Entity.h
– drescherjm
Mar 26 at 23:06
I would try without the
./
before Entity.h
– drescherjm
Mar 26 at 23:06
Maybe you have more than 1
Graphics.h
files that are in different folders.– drescherjm
Mar 26 at 23:07
Maybe you have more than 1
Graphics.h
files that are in different folders.– drescherjm
Mar 26 at 23:07
How did you include Graphics.h? Using <> or "" ?
– immibis
Mar 27 at 0:50
How did you include Graphics.h? Using <> or "" ?
– immibis
Mar 27 at 0:50
|
show 6 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55367119%2fh-file-cannot-see-another-in-the-same-folder-c-eclipse%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55367119%2fh-file-cannot-see-another-in-the-same-folder-c-eclipse%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you changed your include path?
– immibis
Mar 26 at 22:36
nope, i’ve just created a CDT project in Eclipse and away I went. I did add SFML’s include folder to /usr/include but apart from that, no
– AshKetchupp
Mar 26 at 23:03
I would try without the
./
beforeEntity.h
– drescherjm
Mar 26 at 23:06
Maybe you have more than 1
Graphics.h
files that are in different folders.– drescherjm
Mar 26 at 23:07
How did you include Graphics.h? Using <> or "" ?
– immibis
Mar 27 at 0:50