Author Topic: Trying to understand how code::blocks does things  (Read 5114 times)

Offline vulpes_vulpes

  • Single posting newcomer
  • *
  • Posts: 3
Trying to understand how code::blocks does things
« on: July 12, 2024, 08:09:15 pm »
I am trying to understand where/how code::blocks does things. I have used it for simple C based projects in the past, but now I'm trying to use it for Arduino stuff. Yeah I know the wizard is broken, but a wizard only does stuff than can be done manually.

So I have done some compilations one of which looks like this...

Code
avr-g++ -Os -mmcu=atmega328p -I /home/mike/work/arduino-1.8.19/hardware/arduino/avr/cores/arduino -I /home/mike/work/arduino-1.8.19/hardware/arduino/avr/variants/standard -D__AVR_ATmega328P__ -Wall -fno-exceptions -ffunction-sections -fdata-sections -x c++ -s -I /home/mike/.arduino15/packages/arduino/hardware/avr/1.8.19/libraries/HID/src -I /home/mike/.arduino15/packages/arduino/hardware/avr/1.8.19/cores/arduino -DF_CPU=16000000L -DARDUINO=103 -DUSE_EEPROM=0 -DUSE_ETHERNET=0 -DUSE_FIRMATA=0 -DUSE_LCD=0 -DUSE_LCD4884=0 -DUSE_OBD=0 -DUSE_SD=0 -DUSE_SERVO=0 -DUSE_SOFTSERIAL=0 -DUSE_SPI=0 -DUSE_STEPPER=0 -DUSE_TINYGPS=0 -DUSE_WIRE=0 -mmcu=atmega328p -I. -I/usr/bin/arduino/libraries/EEPROM -I/usr/bin/arduino/libraries/Ethernet -I/usr/bin/arduino/libraries/Firmata -I/usr/bin/arduino/libraries/Flash -I/usr/bin/arduino/libraries/LCD4884 -I/usr/bin/arduino/libraries/LCD4Bit_mod -I/usr/bin/arduino/libraries/LiquidCrystal -I/usr/bin/arduino/libraries/OBD -I/usr/bin/arduino/libraries/SD -I/usr/bin/arduino/libraries/SD/utility -I/usr/bin/arduino/libraries/Servo -I/usr/bin/arduino/libraries/SevenSegment -I/usr/bin/arduino/libraries/SoftwareSerial -I/usr/bin/arduino/libraries/SPI -I/usr/bin/arduino/libraries/Stepper -I/usr/bin/arduino/libraries/TinyGPS -I/usr/bin/arduino/libraries/Wire -I/usr/bin/arduino/libraries/Wire/utility -I/usr/bin/arduino/hardware/arduino/cores/arduino -I/usr/bin/arduino/libraries -I/usr/bin/arduino/hardware/arduino/variants/standard -I/home/mike/.arduino15/libraries -c cores/CDC.cpp -o .objs/cores/CDC.o

So looking at the end of this command, we have lots of '-I/usr/bin/arduino...' stuff.

Where does that come from ? Is there a Makefile or something that code::blocks uses ?

I had a hunt about and could not find anything. It is not causing me a problem, I don't have /usr/bin/arduino/<anything> so the lookups fail, and the software compiles OK. I am just curious about how code::blocks works.

For the record this is code::blocks 20.03 on Fedora 39.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7682
    • My Best Post
Re: Trying to understand how code::blocks does things
« Reply #1 on: July 12, 2024, 08:38:19 pm »
Did you install the Compiler needed for ARDUINO?
If yes, where is it installed?
If no, then you need to install the Compiler.

Web searches implies below installs the AVR compiler likely needed for ARDUINO.
Code
yum install avr-gcc-c++

Edit: Looks like more ARDUINO stuff is needed and I forgot where I found the files several years back for an Debian based Linux distro.

Tim S.
« Last Edit: July 13, 2024, 03:52:08 am by stahta01 »
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 vulpes_vulpes

  • Single posting newcomer
  • *
  • Posts: 3
Re: Trying to understand how code::blocks does things
« Reply #2 on: July 13, 2024, 02:42:47 pm »
Thanks for the reply.

Yes the compiler is installed and running OK.

I am just curious what is adding all the "-I /usr/bin/arduino..." stuff to the compile command, and in doing so, trying to understand how code::blocks works.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7682
    • My Best Post
Re: Trying to understand how code::blocks does things
« Reply #3 on: July 13, 2024, 04:43:41 pm »
Thanks for the reply.

Yes the compiler is installed and running OK.

I am just curious what is adding all the "-I /usr/bin/arduino..." stuff to the compile command, and in doing so, trying to understand how code::blocks works.

That came from the Wizard you used.

See project part of https://wiki.codeblocks.org/index.php/FAQ-Compiling_(general)#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

Tim S.
« Last Edit: July 13, 2024, 05:58:09 pm by stahta01 »
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 vulpes_vulpes

  • Single posting newcomer
  • *
  • Posts: 3
Re: Trying to understand how code::blocks does things
« Reply #4 on: July 13, 2024, 08:40:21 pm »
OK. Thanks for the reply.

Well I got some arduino code to compile, link, upload and run, and then discovered the CPU frequency was wrong. I'm guessing that this is another "feature" of the broken arduino project wizard. I edited the project .cbp to put it right, and everything is fine now.

Thanks for the help and pointers on this.