Skip to content

Compilation fails when using multiple source files #31

Closed
@darksworm

Description

@darksworm

User story: When writing more complicated arduino sketches, I want to split the code up into multiple files.

Issue: Currently if I try to use include to inclue another source file, the compilation fails.

How to recreate

Create two files in the same directory:

// test.c.ino
#include "test.h"

void setup() {}
void loop() {}
// test.h
// this file is empty

Try to compile & upload the sketch and this error will appear:

test.c:1:10: fatal error: test.h: No such file or directory
 19  #include "test.h"
 20     ┆   ┆ ^~~~~~~~
 21 compilation terminated.
 22 exit status 1

This code, however, compiles and uploads successfully when using the arduino-ide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions