xpertsavenue/WiringOP-Zero

Make Failed...

Opened this issue · 3 comments

root@orangepizero:/home/orangepi# git clone https://github.com/xpertsavenue/WiringOP-Zero.git
Cloning into 'WiringOP-Zero'...
remote: Counting objects: 296, done.
remote: Total 296 (delta 0), reused 0 (delta 0), pack-reused 296
Receiving objects: 100% (296/296), 301.26 KiB | 396.00 KiB/s, done.
Resolving deltas: 100% (149/149), done.
Checking connectivity... done.
root@orangepizero:/home/orangepi# cd WiringOP-Zero
root@orangepizero:/home/orangepi/WiringOP-Zero# chmod +x ./build
root@orangepizero:/home/orangepi/WiringOP-Zero# sudo ./build
./build: 4: ./build: [[: not found
wiringPi Build script

WiringPi Library
[UnInstall]
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] mcp23008.c
[Compile] mcp23016.c
[Compile] mcp23017.c
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] sn3218.c
[Compile] drcSerial.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

WiringPi Devices Library
[UnInstall]
[Compile] hx711.c
hx711.c: In function ‘hx711Read’:
hx711.c:75:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (uint8_t i = 24; i--;)
^
hx711.c:75:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to c ompile your code
hx711.c:86:11: error: conflicting types for ‘i’
for (int i = 0; i < sGainBits[instId]; i++)
^
hx711.c:75:15: note: previous definition of ‘i’ was here
for (uint8_t i = 24; i--;)
^
hx711.c:86:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < sGainBits[instId]; i++)
^
hx711.c: In function ‘hx711ReadAverage’:
hx711.c:103:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (uint8_t i = 0; i < times; i++)
^
Makefile:67: recipe for target 'hx711.o' failed
make: *** [hx711.o] Error 1

Make Failed...``

from clean install!! what i have to do? {i run Armbian_5.35_Orangepizero_Debian_jessie_default_3.4.113}

Problem with hx711, i comment it in MakeFile, fixed version
https://github.com/vladikoms/WiringOP-Zero

Thanks vladikoms

kxion commented

‘for’ loop initial declarations are only allowed in C99 or C11 mode

so

diff --git a/devLib/hx711.c b/devLib/hx711.c
index 3b54efb..33800f9 100644
--- a/devLib/hx711.c
+++ b/devLib/hx711.c
@@ -72,7 +72,8 @@ int hx711Read(uint8_t instId)

    int data = 0;
    // pulse the clock pin 24 times to read the data

- for (uint8_t i = 24; i--;)
+ uint8_t i;
+ for (i = 24; i--;)
{
digitalWrite(sClockPin[instId], HIGH);

@@ -83,7 +84,8 @@ int hx711Read(uint8_t instId)
}

    // set the channel and the gain factor for the next reading using the clock pin

- for (int i = 0; i < sGainBits[instId]; i++)
+ int j;
+ for (j = 0; j < sGainBits[instId]; j++)
{
digitalWrite(sClockPin[instId], HIGH);
digitalWrite(sClockPin[instId], LOW);
@@ -100,7 +102,8 @@ int hx711Read(uint8_t instId)
int hx711ReadAverage(uint8_t times, uint8_t instId)
{
int64_t sum = 0;
- for (uint8_t i = 0; i < times; i++)
+ uint8_t i;
+ for (i = 0; i < times; i++)
{
sum += hx711Read(instId);
}