Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#includes in included files are not recognized #189

Closed
martenlienen opened this issue May 2, 2015 · 6 comments
Closed

#includes in included files are not recognized #189

martenlienen opened this issue May 2, 2015 · 6 comments
Assignees
Labels
Milestone

Comments

@martenlienen
Copy link

Hi,
I wrote a wrapper for Servo.h

// In motor.h
#include <Servo.>

class Motor {...}
// In main.cpp
#include "motor.h"

When I run platformio run, it does not recognize the #include <Servo.h> directive and so the -I switch for it is missing, when platformio calls avr-g++. I tracked it down to this line, but do not know SCons, so I hope, that this is enough to fix it. The problem seems to be, that env.File is constructing an SCons.Node.FS.File object for the path "src/motor.h", but the File constructor manipulates this path to "scripts/src/motor.h", which does not exists. Then node.get_text_contents() returns "", which obviously does not include the #include directive.

@ivankravets
Copy link
Member

Is this a typo in this line #include <Servo.>? Try to replace it to #include <Servo.h>

@martenlienen
Copy link
Author

No, sorry, that was just a typo on here. I created a minimal environment to provoke the bug.

Running platformio run there produces the following output

(.env)❯ platformio run
[Sun May  3 23:26:27 2015] Processing uno (targets: upload, platform: atmelavr, board: uno, framework: arduino)
-----------------------------------------------------------------------------
avr-g++ -o .pioenvs/uno/src/Motor.o -c -fno-exceptions -fno-threadsafe-statics -g -Os -Wall -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO -DARDUINO=10603 -DPLATFORMIO=010400 -I.pioenvs/uno/FrameworkArduino -I.pioenvs/uno/FrameworkArduinoVariant .pioenvs/uno/src/Motor.cpp
In file included from .pioenvs/uno/src/Motor.cpp:1:0:
.pioenvs/uno/src/Motor.h:1:19: fatal error: Servo.h: No such file or directory
#include <Servo.h>
^
compilation terminated.
scons: *** [.pioenvs/uno/src/Motor.o] Error 1

@ivankravets ivankravets added this to the 1.5.0 milestone May 3, 2015
@ivankravets
Copy link
Member

@valeros Please re-test it. Thanks in advance!

@valeros valeros assigned ivankravets and unassigned valeros May 4, 2015
@ivankravets
Copy link
Member

@cqql Thanks for report. I've just reproduced it and will fix tomorrow.

@ivankravets
Copy link
Member

@cqql Please re-test it using PlatformIO Development Version.

Thanks in advance!

@martenlienen
Copy link
Author

Now it works as expected.

Thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants