C++ broken stuff whatever shit dog

C++ broken stuff whatever shit dog

sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
cluster.ino|2|error: BlackThornDemon.h: No such file or directory|
cluster.ino|3|error: 'BlackThornDemon' does not name a type|
src\BlackThornDemon.cpp|2|error: BlackThornDemon.h: No such file or directory|
src\BlackThornDemon.cpp|4|error: 'BlackThornDemon' has not been declared|

cluster.ino
code
#include <Arduino.h>
#include <BlackThornDemon.h>
BlackThornDemon obd2(2);
char rxData[20];
byte rxIndex=0;

byte speed=0;
/*
rpm is returned at 1/4 the actual rpm
so the range should be 0-2000
*/
int rpm=0;
float fuel=0.00;
/*
int because byte only goes to 255
noraml operatring temps are ~190-200f
so the possibility of the coolant temp
getting over 255 is evident
and if your car is on fire you prolly
want to know
*/
int coolantTemp=0;
// NOTE: we have to read this from the storage device
int odometer=0;
int trip=0;


void setup()
{
Serial.begin(9600); // so we can talk to obd2
delay(500);
Serial.println("ATZ"); //reset obd2
delay(1000);

Serial.flush(); // purge the serial buffer
}

void loop()
{
Serial.flush();
Serial.println("010D"); // tell obd2 to send us speed
//obd2.GetResponse(); // returns the command we sent ("010D")
//obd2.GetResponse(); // returns the data


}


blackthorndemon.h
c code
#ifndef BlackThornDemon_h
#define BlackThornDemon_h
#include "Arduino.h"
class BlackThornDemon
{
public:
BlackThornDemon(int pin);
void GetResponse();
virtual ~BlackThornDemon();
protected:
private:
};


#endif // BLACKTHORNDEMON_H


blackthorndemon.c
c code
#include "Arduino.h"
#include "BlackThornDemon.h"

BlackThornDemon::BlackThornDemon(int pin)
{
pin = pin + pin;
}
BlackThornDemon::GetResponse()
{

}
BlackThornDemon::~BlackThornDemon()
{
//dtor
}
 
 
 
2013 May 11 at 12:02 PDT — Ed. 2013 May 11 at 12:03 PDT
SuperJer
Websiteman

2005 Mar 20 • 6629
It appears your platform/compiler is case-sensitive with respect to filenames, and you are including BlackThornDemon.h when the file is actually blackthorndemon.h.
 
 
 
2013 May 11 at 17:17 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Nope. Checked 5+ times. All the file names are the exact same. BlackThornDemon.

I just started copying the header and source to all the folders on my hdd. Works now.
 
 
 
2013 May 11 at 18:16 PDT — Ed. 2013 May 11 at 18:30 PDT
SuperJer
Websiteman

2005 Mar 20 • 6629
What compiler are you using? You should be able to pass it a list of include directories.

You can also change your #include lines to specify relative paths if needed, e.g.

#include "stuff/things.h"
 
 
 
2013 May 11 at 18:34 PDT — Ed. 2013 May 11 at 18:34 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
CodeBlocks for Arduino.
 
 
 
2013 May 11 at 19:03 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
Basically, #include <header.h> will look in standard OS locations for header files. Like, I dunno, gcc's install directory, Visual Studio's defined header locations, whatever. It will also look in the locations you pass to the compiler, probably with a flag like -I"../path/to/hedders". This is why the compiler can't find it.

You actually want #include "header.h", which will look in the current directory (or as superjer notes you can pass a relative path in there, if that's what turns you on).

So to clarify: #include "BlackThornDemon.h". What kind of header file has that name anyway? :s

There's more, you probably want #include <Arduino.h> but that seems to be working regardless, also you will need #include "../BlackThornDemon.h", just like superjer said. When it tells you it can't find the file, there's a reason. It's because it's not where it's looking! And I tend to trust the computer when it says it can't find it.
 
 
 
2013 May 12 at 09:01 PDT — Ed. 2013 May 12 at 09:04 PDT
Page [1]