Problem with compiling for Nano on IDE

I am trying to get IDE to compile a simple serial com code for Nano, but, I am running into compile error. can't understand what/why. can anyone help please?

code:

// Nano (Sender) Code

#define LED_PIN 13  // Status LED on Nano

void setup() {
    Serial.begin(9600);  // Initialize Serial Communication
    pinMode(LED_PIN, OUTPUT);
}

void loop() {
    Serial.println("LED_ON");   // Send command to Mega
    digitalWrite(LED_PIN, HIGH);
    delay(2000);  // Wait 2 seconds

    Serial.println("LED_OFF");  // Send command to Mega
    digitalWrite(LED_PIN, LOW);
    delay(2000);  // Wait 2 seconds
}

error:

C:\Users\ADMIN\AppData\Local\Temp\cc9BbG0G.ltrans0.ltrans.o:(.rodata+0x6): undefined reference to Print::write(unsigned char const*, unsigned int)' c:/users/admin/appdata/local/arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/avr5/crtatmega328p.o:(.init9+0x0): undefined reference to main'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

I moved your topic to an appropriate forum category @siv-ide .

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

  • The sketch you posted compiles and runs as expected here. (IDE 1.8.18)

Hi @siv-ide. Which version of Arduino IDE are you using (e.g., "2.0.1")? The version is shown on the window title bar and also in the dialog that opens when you select Help > About (or Arduino IDE > About Arduino IDE for macOS users) from the Arduino IDE menus.

I ask for this information because I want to give you the appropriate instructions for the IDE version you are using.

Turn on verbose

Hello Ptillisch,
its the 2.3.4.

Not sure if I am having library issue!!

ha...I should try that.

Describe your Nano - Classic, Every, R4 Minima, what? There are several to choose from.

its V3

This more than likely indicates that you have a corrupt installation. Is this the first time that you try to use the IDE?

I would suggest to downgrade the AVR board package (it should be 1.8.6 currently) to e.g. 1.8.3 using the board manager and try again. If that works, you can upgrade to 1.8.6 again.

No, ive used this IDE countless times before and have compled and downloded onto other boards (UNO/MEGA/MEGA 2560 mini Pro/ and even Nano classic etc). Had no issues then.

Since this issue first appeared, I've reinstalled this IDE twice now and installed it again. Did this on via windows uninstall add/remove etc etc. Windows operating sysetm is Win 10.

Not sure of any of that makes any difference!!

Every time I see a similar post using IDE 2.XX , I adjust my doomsday clock for using ide 2.xx 1 year on.

1 Like

So it used to work for all AVR based boards. Select another board (e.g. Mega) and compile (no need to upload).
Create an empty sketch; save it as something (!!) and compile. Does the compile still fail?

Did you try the downgrade/upgrade as suggested?

Another step to solve the issue could be to clear the cache in C:\Users\yourUsername\AppData\Local\arduino.

Just re-installing the IDE will not help. You have to clean out all directories that "belong to the IDE". A list here: https://support.arduino.cc/hc/en-us/articles/4415103213714-Find-sketches-libraries-board-cores-and-other-files-on-your-computer#boards.

So, cleaning the cache still ned to do yet, just that cache seems to have some of my code bits in there too.

So, I've downloaded the 1.8.6

I've downloaded and that worked loading up the Nano sketch onto it.

But, the sketch still not communicating between Mega mini Pro 2560 and Nano!!

I've checked the TX,RX and GND all ok.

It has a "copy" of your code; it's safe to delete (I do it quite often). If you're familiar with other IDEs for software development they usually have an option to do a clean build; clearing the cache has the same effect.

In IDE 1.8.x the cache (it's an other directory) is cleared when you close the IDE.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.