bora
bora

Reputation: 11

Arduino code doesn't work after including my C libraries

I wrote a library in C and I m trying to use it now in Arduino. The C code on Codeblocks works fine even on Arduino I don't get compilation errorS. However after including the header in Arduino even Serial.print() stopped showing anything on the serial monitor. So why this is happening? Here is the code i m not even testing any of the library fonctions:

#include <IdentificationModule.h>
#include <MangementModule.h>
#include <SupFunctions.h>

void setup() {
  Serial.begin(9600);
  // put your setup code here, to run once:
// uint8_t b=4;
Serial.print( "Test");

}

void loop() {


}

enter image description here

Upvotes: 0

Views: 267

Answers (3)

bora
bora

Reputation: 11

First of all maybe my probleme was kind of my code was too large too large and arduino does not even upload it to the device because when i removed some of the unecessary inludce that Serial.print( "Test") worked. After that when I tried to test the library fonctions I get "undefined reference to" But strangely when I changed the extinction of the source code from ".c" to ".cpp" it worked !!!

Upvotes: 0

Alberto Valero
Alberto Valero

Reputation: 440

You should show us you source files. If it compiles well (are you sure of that) there is no apparent reason not to work. Unless you are modifying something of the Arduino core on you files.

Upvotes: 0

Nitro
Nitro

Reputation: 1093

Go to File>Preferences

in the line containing

Show Verbose output during 

Select the checkbox for compilation.

Then add a line anywhere in your code (Ensuring that the added line does not cause compilation errors) and re-compile the code.

You should see warnings and errors that will point you in the right direction.

Upvotes: 1

Related Questions