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 a separate file #1382

Closed
tobyb121 opened this issue Apr 24, 2013 · 1 comment
Closed

Includes in a separate file #1382

tobyb121 opened this issue Apr 24, 2013 · 1 comment
Labels
Type: Duplicate Another item already exists for this topic

Comments

@tobyb121
Copy link

When a standard library is included in a separate file from the main sketch ino, the error: " error: '###' was not declared in this scope" occurs when compiling.
This has been tested on Arduino IDE v 1.0.3 on Windows 8 x64
The following code does not compile without line 1 of mainSketch.ino being un-commented.

mainSketch.ino

// #include <Wire.h>
#include "myLibrary.h"

void setup(){
  initWire();
}

void loop(){}

myLibrary.h

#pragma once
#ifndef MY_LIBRARY_H
#define MY_LIBRARY_H

#include <Wire.h>

void initWire();

#endif

myLibrary.cpp

#include "myLibrary.h"

void initWire(){
  Wire.begin();
}
@cmaglie
Copy link
Member

cmaglie commented Apr 27, 2013

Duplicate of #236
Note: the issue started long ago on gc http://code.google.com/p/arduino/issues/detail?id=236

@cmaglie cmaglie closed this as completed Apr 27, 2013
@per1234 per1234 added the Type: Duplicate Another item already exists for this topic label Jul 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Duplicate Another item already exists for this topic
Projects
None yet
Development

No branches or pull requests

3 participants