avr-g++: error: missing filename after '-o'

Hi,
I'm suddenly having problems compiling sketches in arduino IDE 1.6.6. This happens no matter what sketch I try to compile and/or upload, do this post contains a simple read and print from a potentiometer (shown below).

I tried installing the IDE all over again, but the same message keeps appearing.
I have tried connecting both arduino UNO and Leonardo, but still no success.

Does anyone know how to fix this?

The error message and code is as follows:

Error message:

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\Users\Erik Karlsson\AppData\Local\Arduino15\packages" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\Users\Erik Karlsson\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\Erik Karlsson\Documents\Arduino\libraries" -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10606 -build-path "C:\Users\ERIKKA~1\AppData\Local\Temp\build9de2fa4457d497e19d26c984c9306df4.tmp" -warnings=all -prefs=build.warn_data_percentage=75 -verbose "C:\Users\Erik Karlsson\Documents\Arduino\sketch_apr05a\sketch_apr05a.ino"
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -hardware "C:\Users\Erik Karlsson\AppData\Local\Arduino15\packages" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -tools "C:\Users\Erik Karlsson\AppData\Local\Arduino15\packages" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\Erik Karlsson\Documents\Arduino\libraries" -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10606 -build-path "C:\Users\ERIKKA~1\AppData\Local\Temp\build9de2fa4457d497e19d26c984c9306df4.tmp" -warnings=all -prefs=build.warn_data_percentage=75 -verbose "C:\Users\Erik Karlsson\Documents\Arduino\sketch_apr05a\sketch_apr05a.ino"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -M -MG -MP -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10606 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino" "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\variants\standard" "C:\Users\ERIKKA~1\AppData\Local\Temp\build9de2fa4457d497e19d26c984c9306df4.tmp\sketch\sketch_apr05a.ino.cpp"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -M -MG -MP -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10606 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino" "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\variants\standard" "C:\Users\ERIKKA~1\AppData\Local\Temp\build9de2fa4457d497e19d26c984c9306df4.tmp\sketch\sketch_apr05a.ino.cpp"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -M -MG -MP -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10606 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino" "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\variants\standard" "C:\Users\ERIKKA~1\AppData\Local\Temp\build9de2fa4457d497e19d26c984c9306df4.tmp\sketch\sketch_apr05a.ino.cpp"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -M -MG -MP -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10606 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino" "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\variants\standard" "C:\Users\ERIKKA~1\AppData\Local\Temp\build9de2fa4457d497e19d26c984c9306df4.tmp\sketch\sketch_apr05a.ino.cpp"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -M -MG -MP -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10606 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino" "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\variants\standard" "C:\Users\ERIKKA~1\AppData\Local\Temp\build9de2fa4457d497e19d26c984c9306df4.tmp\sketch\sketch_apr05a.ino.cpp"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10606 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\cores\arduino" "-IC:\Users\Erik Karlsson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.10\variants\standard" "C:\Users\ERIKKA~1\AppData\Local\Temp\build9de2fa4457d497e19d26c984c9306df4.tmp\sketch\sketch_apr05a.ino.cpp" -o ""
avr-g++: error: missing filename after '-o'

exit status 1
Error compiling.

Code:

const int potPin = A0;
int potRead = 0;

void setup() {
  Serial.begin(9600);
  pinMode(potPin, INPUT);
}

void loop() {
  potRead = analogRead(potPin);
  Serial.println(potRead);
  delay(500);
}

Help is very much appreciated! :slight_smile:

Changed:-

const int potPin = A0;

to

int potPin = A0;

and the code works.

replace original line back....

const int potPin = A0;
int potRead = 0;

void setup() {
  Serial.begin(9600);
  pinMode(potPin, INPUT);
}

void loop() {
  potRead = analogRead(potPin);
  Serial.println(potRead);
  delay(500);
}

and code works.

Tried original code again and this now works.
So to summerise, try compiling your code again as there might have been a glitch.

G

Thanks for the reply Zardof!

I have now tried to compile the same code again in IDE 1.6.8 which works (also with other codes)

Code:

const int potPin = A0;
int potRead = 0;

void setup() {
  Serial.begin(9600);
  pinMode(potPin, INPUT);
}

void loop() {
  potRead = analogRead(potPin);
  Serial.println(potRead);
  delay(500);
}

But the code, or any other code for that matter, won't compile in 1.6.6 for some reason I don't understand..

Could it be an error in the libraries connected to IDE 1.6.6? I use a joystick library and serial communication with Processing which won't work properly IDE 1.6.8.

My code worked for several weeks with no flaws, but then suddenly the error mentioned above shows up. Might it be some library updates that won't work properly on IDE 1.6.6?

Sorry, I can't help further.
I can't understand why the posted code took two attempts to compile and was then OK.

My code worked for several weeks with no flaws, but then suddenly the error mentioned above shows up. Might it be some library updates that won't work properly on IDE 1.6.6?

Usually if code works for a couple of weeks then faults it is down to an overflow of milli storing register (in my limited experience).

G

Zardof:
Usually if code works for a couple of weeks then faults it is down to an overflow of milli storing register (in my limited experience).

In this case the error shows up during compilation, not execution, so 'millis()' rollover definitely has nothing to do with it.

Incidentally, I compiled the code with V1.6.5 and there were no errors. (Only took one attempt.)
V1.6.6 and later all reportedly have issues though, which may be causing the problem.
I've steadfastly stuck with V1.6.5 for this very reason - it's the last known stable version.

It turns out that this is a common problem that occurs when using IDE V1.6.6 with Arduino AVR Boards V1.6.10.

More info here:- Re: help to start

(I know you've now fixed it erikak, but just thought I'd post this for anyone that comes across this thread in the future.)

Thanks for the replies guys!

Too bad there is a common IDE problem, but I have a workaround with several IDEs for now.