Author Topic: [Solved] Problems with setting up CB for avr  (Read 3784 times)

Offline mauromago

  • Single posting newcomer
  • *
  • Posts: 3
[Solved] Problems with setting up CB for avr
« on: December 27, 2016, 12:28:22 am »
Hi

This is my first message on the forum, so let me present myself a little.
I'm programming in more language but I'm not a programmer. Programming and be a programmer are different in my mind  :D
I'm new to CB and just little bit used to AVR.

Few days ago I revived an old project (some years) based on AVR uC. The original program was not wrote by me, and was developed on AVRstudio  (so windows machine). I'm using Linux and I don't like to move my habit just to follow the easiest way.
I decided to chose CB as IDE and I installed the tool chain for AVR too.

I moved the old sources to a new project and I tried to build it. At the beginning I have had some errors because a missing standard library (inttypes.h). That make me thinking tool chain package was not totally right.

Now I have still one error (really 12 but are all the same type) but library looks be correctly installed (stdio.h).

OS Lubuntu 14.04
CB version 13.12
AVR tool chain 1.8.0

The build messsage is
Code
||=== Build: Debug in sempy (compiler: GNU GCC Compiler for AVR) ===|
/home/mauro/cb-projects/sempy/CostaPra.c|41|riferimento non definito a "stdout"|
/home/mauro/cb-projects/sempy/CostaPra.c|41|riferimento non definito a "stdout"|
/home/mauro/cb-projects/sempy/CostaPra.c|41|riferimento non definito a "stdout"|
/home/mauro/cb-projects/sempy/CostaPra.c|41|riferimento non definito a "stdout"|
/home/mauro/cb-projects/sempy/CostaPra.c|41|riferimento non definito a "stdin"|
/home/mauro/cb-projects/sempy/CostaPra.c|41|riferimento non definito a "stdin"|
/home/mauro/cb-projects/sempy/CostaPra.c|220|riferimento non definito a "__isoc99_sscanf"|
/home/mauro/cb-projects/sempy/CostaPra.c|233|riferimento non definito a "__isoc99_sscanf"|
/home/mauro/cb-projects/sempy/CostaPra.c|238|riferimento non definito a "__isoc99_sscanf"|
/home/mauro/cb-projects/sempy/CostaPra.c|243|riferimento non definito a "__isoc99_sscanf"|
/home/mauro/cb-projects/sempy/CostaPra.c|248|riferimento non definito a "__isoc99_sscanf"|
obj/Debug/CostaPra.o:/home/mauro/cb-projects/sempy/CostaPra.c|253|seguono ulteriori riferimenti non definiti a "__isoc99_sscanf"|
||=== Build failed: 12 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

And the line for first error is
Code
  stdin = stdout = fdevopen(my_put, my_get);

I suppose that error is in the general set up of CB, but I don't have idea of how it need to be corrected.
In the project build option in the linker setting there is nothing, but other standard lib looks working and that let me confused.

Also compiling the single file don't return any error, so I more confused.  :o

MM
« Last Edit: December 27, 2016, 12:26:42 pm by mauromago »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Problems with setting up CB for avr
« Reply #1 on: December 27, 2016, 12:54:31 am »
I suggest posting a "build log" NOT build messages on a site that supports the Compiler.
You can also post the "build log" here and somebody might see a mistake.

http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline mauromago

  • Single posting newcomer
  • *
  • Posts: 3
Re: Problems with setting up CB for avr
« Reply #2 on: December 27, 2016, 03:51:36 am »
thanks for repling.

here the log
Code
-------------- Clean: Debug in sempy (compiler: GNU GCC Compiler for AVR)---------------

Cleaned "sempy - Debug"

-------------- Build: Debug in sempy (compiler: GNU GCC Compiler for AVR)---------------

avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c Analog.c -o obj/Debug/Analog.o
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c CostaPra.c -o obj/Debug/CostaPra.o
CostaPra.c: In function ‘main’:
CostaPra.c:41:3: warning: implicit declaration of function ‘fdevopen’ [-Wimplicit-function-declaration]
   stdin = stdout = fdevopen(my_put, my_get);
   ^
CostaPra.c:41:18: warning: assignment makes pointer from integer without a cast [enabled by default]
   stdin = stdout = fdevopen(my_put, my_get);
                  ^
CostaPra.c:218:7: warning: implicit declaration of function ‘printf_P’ [-Wimplicit-function-declaration]
       printf_P(PSTR("Can? "));         // numero di canali
       ^
CostaPra.c:219:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:232:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:237:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:242:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:247:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:252:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:257:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:262:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:270:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:277:7: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
       gets(tmp);
       ^
CostaPra.c:360:9: warning: too many arguments for format [-Wformat-extra-args]
         printf(" %d ", i," %d ", p);
         ^
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c fuses.c -o obj/Debug/fuses.o
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c Ic2.c -o obj/Debug/Ic2.o
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c Init.c -o obj/Debug/Init.o
Init.c: In function ‘InitRTC’:
Init.c:105:7: warning: implicit declaration of function ‘printf_P’ [-Wimplicit-function-declaration]
       printf_P(PSTR("init"));
       ^
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c key.c -o obj/Debug/key.o
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c LocUtil.c -o obj/Debug/LocUtil.o
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c Rtc.c -o obj/Debug/Rtc.o
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c Test.c -o obj/Debug/Test.o
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c Timer.c -o obj/Debug/Timer.o
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c Util.c -o obj/Debug/Util.o
avr-gcc -mmcu=atmega32 -Wall -g -DF_CPU=16000000UL -g -I/usr/include -I/usr/lib -c valvole.c -o obj/Debug/valvole.o
valvole.c: In function ‘ControlloGonfio’:
valvole.c:45:9: warning: implicit declaration of function ‘printf_P’ [-Wimplicit-function-declaration]
         printf_P(PSTR("NON SI GONFIA"));
         ^
avr-g++ -L/usr/lib -o bin/Debug/sempy.elf obj/Debug/Analog.o obj/Debug/CostaPra.o obj/Debug/fuses.o obj/Debug/Ic2.o obj/Debug/Init.o obj/Debug/key.o obj/Debug/LocUtil.o obj/Debug/Rtc.o obj/Debug/Test.o obj/Debug/Timer.o obj/Debug/Util.o obj/Debug/valvole.o  -mmcu=atmega32 -Wl,-Map=bin/Debug/sempy.map,--cref 
obj/Debug/CostaPra.o: nella funzione "main":
/home/mauro/cb-projects/sempy/CostaPra.c:41: riferimento non definito a "stdout"
/home/mauro/cb-projects/sempy/CostaPra.c:41: riferimento non definito a "stdout"
/home/mauro/cb-projects/sempy/CostaPra.c:41: riferimento non definito a "stdout"
/home/mauro/cb-projects/sempy/CostaPra.c:41: riferimento non definito a "stdout"
/home/mauro/cb-projects/sempy/CostaPra.c:41: riferimento non definito a "stdin"
/home/mauro/cb-projects/sempy/CostaPra.c:41: riferimento non definito a "stdin"
/home/mauro/cb-projects/sempy/CostaPra.c:220: riferimento non definito a "__isoc99_sscanf"
/home/mauro/cb-projects/sempy/CostaPra.c:233: riferimento non definito a "__isoc99_sscanf"
/home/mauro/cb-projects/sempy/CostaPra.c:238: riferimento non definito a "__isoc99_sscanf"
/home/mauro/cb-projects/sempy/CostaPra.c:243: riferimento non definito a "__isoc99_sscanf"
/home/mauro/cb-projects/sempy/CostaPra.c:248: riferimento non definito a "__isoc99_sscanf"
obj/Debug/CostaPra.o:/home/mauro/cb-projects/sempy/CostaPra.c:253: seguono ulteriori riferimenti non definiti a "__isoc99_sscanf"
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 3 second(s))
12 error(s), 16 warning(s) (0 minute(s), 3 second(s))
 

MM

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Problems with setting up CB for avr
« Reply #3 on: December 27, 2016, 11:14:23 am »
Uff, you've hit the known problem no one knows how to reproduce.
To fix it go to the Settings -> Compiler -> GNU GCC Compiler for AVR -> Search dirs and remove /usr/include and /usr/lib from there.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline mauromago

  • Single posting newcomer
  • *
  • Posts: 3
Re: Problems with setting up CB for avr
« Reply #4 on: December 27, 2016, 12:26:09 pm »
WORKS !  ;D

It don't compile yet due to another error, but it is solved. Many thanks  :)

MM