Pages: [1]   Go Down
Author Topic: IDE 0013: error compiling (WProgram.h stlib.h)  (Read 937 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a sketch that works with the IDE 0011 (Windows Vista), I've just installed the new version (IDE 0013) but I can't compile because it gives me an error.

This is the error:

In file included from C:\Program Files\arduino-0013\hardware\cores\arduino/WProgram.h:4,
c:/program files/arduino-0013/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected unqualified-id before 'int'
c:/program files/arduino-0013/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'
c:/program files/arduino-0013/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'
In file included from C:\Program Files\arduino-0013\hardware\cores\arduino/WProgram.h:6,

Can anybody help me?
Thanks in advance.

mtz
Logged

Connecticut, US
Offline Offline
Edison Member
*
Karma: 2
Posts: 1036
Whatduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

On that line in avr's stdlib.h is the declaration for int abs(int).

Did you mix up the files with prior versions of the IDE?  Did you call the abs() function with an argument that was cast to integer with this syntax:  int(x) ?  Do any tabs of your sketch end in the .c filename instead of .cpp?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, I don't. Only I put my own librarys...
In any library nor skecth I use abs() function...

Maybe I've files ended in .c in the librarys...
Logged

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, the problem here is caused by the fact that in wiring.h we still for some reason define our own version of abs.

I'm glad we removed all the #define int... etc. from 0012, but I really think we should also remove the definitions for macros that are also #defined elsewhere, especially since stdlib.h seems to be automatically included these days.

You might try simply adding

Code:
#undef abs

at the top of your sketch right after all the #include lines.

Mikal
« Last Edit: February 12, 2009, 12:30:56 pm by mikalhart » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah...

You have been faster than me... I found it too...

Thanks a lot...
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found the exact same problem when I compiled a sketch I'm working on to control some servo motors with the Servo Library I downloaded from the "Contributed Libraries" section of the arduino website.

When I add the "#undef abs" line underneath my #include lines I get the same error message except now it says 'double' instead of 'int'.

I am so confused!
Logged

Lille - France
Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had exactly the same problem as you wjoojoo and someone on IRC told me to add #include <WProgram.h> at the right beginning of my sketch, and it works now
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yupp - just come across exactly the same problem on 0014.  Adding #include <WProgram.h> before any other #includes fixes it...   ;D
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i think i am having the same problem as wjoojoo. i have some servos that i want to control with the servotimetimer1 library but it is giving me hell. i have tried all the stuff suggested in old posts.

initially it was giving me the
In file included from C:\Program Files\arduino-0013\hardware\cores\arduino/WProgram.h:4,
c:/program files/arduino-0013/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected unqualified-id before 'int'
c:/program files/arduino-0013/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'
c:/program files/arduino-0013/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'
In file included from C:\Program Files\arduino-0013\hardware\cores\arduino/WProgram.h:6,

i #included the <WProgram.h> and this allowed it to compile but it still will not control my servos. so i went on to changes:
TIMSK0 &= ~(_BV(TICIE1) | _BV(OCIE1A) | _BV(OCIE1B) | _BV(TOIE1) );
    to:
 TIMSK0 &= ~(_BV(OCIE1A) | _BV(OCIE1B) | _BV(TOIE1) );
    and then to:
TIMSK0 &= ~( _BV(ICIE1) | _BV(OCIE1A) | _BV(OCIE1B) | _BV(TOIE1) );

and still nothing

any help to get this library working or info on how to control some servos more accurately than the servo library can do would be great.
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6250
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
i have some servos that i want to control with the servotimetimer1 library

why not use the Servo library distributed with Arduino 0012 and later,
It looks functionally the same to me.
« Last Edit: March 16, 2009, 02:45:56 pm by mem » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you can only control a servo with accuracy of a degree. I want to be able to turn a servo half a degree if i wanted to.
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6250
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
you can only control a servo with accuracy of a degree. I want to be able to turn a servo half a degree if i wanted to.
perhaps you are looking at a different library, my copy of ServoTimer1 has the same capabilities (and limitations) as Servo.

BTW, half a degree is about 0.3% of the movement of the servo. I would be (pleasantly) surprised if the pot and feedback circuit of a servo was half that accurate.
« Last Edit: March 16, 2009, 03:31:37 pm by mem » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

im looking at the servotimetimer1 library and i thought that that would allow you to enter the pulse you want rather than the degree you want. if i could enter the pules i want im am only limited by the servo like you said. but if i can only enter the degree i am limited by the library. like if 0 degrees is a 600ms pulse and 1 degree is 610, i want to be bale to enter the 605 that servotimetimer1 allows not only the 1 or 0 that servo allows.
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6250
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you post a link to the ServoTime1 library that allows input in microseconds
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.arduino.cc/playground/ComponentLib/Servotimetimer1

this is the one that i cannot get to work, the normal servo library works fine.
Logged

Pages: [1]   Go Up
Jump to: