Questions tagged [gcc]

Users invoke a language-specific driver program (gcc for C, g++ for C++, etc.), which interprets command arguments, calls the actual compiler, runs the assembler on the output, and then optionally runs the linker to produce a complete executable binary.

Filter by
Sorted by
Tagged with
1 vote
0 answers
94 views

Trying to show g++ (linter-gcc for Atom) where to find Arduino libs

I'm trying to use Atom as an IDE for arduino and arduino-based boards. I'm using arduino-cli for compilation and avrdude for upload, and now I'm trying to use linter-gcc for linting. g++ is running ...
Jonathan Musther's user avatar
0 votes
1 answer
241 views

C++ State Machine / Wpmf-convesion

I'm quite a newbie using C ++. I am trying to implement in C ++, the state machine described in this link for C language: https://barrgroup.com/Embedded-Systems/How-To/Coding-State-Machines. I have ...
ezeg's user avatar
  • 18
1 vote
2 answers
1k views

How do I make Arduino IDE use a specific version of GCC in Debian?

Using Raspbian Stretch. I installed gcc-4.9 with specified version. Then I installed arduino (2.1.0.5) which in turn pulled gcc 4.6. When I try to compile Marlin in it, it says Marlin requires C++...
Dmitry Fedorkov's user avatar
1 vote
1 answer
124 views

using references to SFRs in gcc inline assembler

I want to write a driver that can use either timer0 or timer2, based on a choice made at compile time. So I want all references to timer registers to be abstracted, e.g. OCRA for OCR0A/OCR2A, etc. I ...
kuroi neko's user avatar
7 votes
1 answer
2k views

Accessing a C++ static variable from gcc inline asm

For some reason I want to mix a bit of assembly with C++ (not C). To allow the code to be compilable using the standard Arduino IDE, I don't want to use direct assembly source. I don't want to use a ...
kuroi neko's user avatar
0 votes
1 answer
793 views

UECIDE: linker error with U8g2 library

This sketch: #include <SPI.h> #include <Wire.h> #include <U8g2lib.h> // OLED display. U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); void setup()...
user avatar
0 votes
3 answers
10k views

Does int array[100] = {0} construct work on Arduino?

I'm compiling my code in Arduino IDE. I have an array that I want to 0-initialize. I know memset works on Arduino, but I'm used to this way from my desktop C++ programming practice: int array[100] = {...
Violet Giraffe's user avatar
1 vote
1 answer
579 views

How do I order the gcc compiler to generate -S flag in Arduino IDE

How can I set the Arduido IDE to generate the -S flag to gcc to see the machine code in Arduino? (the sketches)
user avatar
0 votes
2 answers
17k views

GCC msg "note: in definition of macro 'max'" error message

I'm using the ATtiny x5 series board, compiling my project (.cpp.ino file). Whenever I use the max(a,b) macro, I receive this message: "C:\Documents and Settings\<user>\Local Settings\...
HiTechHiTouch's user avatar
1 vote
1 answer
2k views

Inheritance not working as expected

Short version: This is a lighting control project. Some of the clases are Pin and Channel. Channel contains a Pin. Pin is a base class for DigitalOutPin and will be the base class for AnalogOutPin, ...
dj_segfault's user avatar
2 votes
0 answers
899 views

Error with libraries after setting up Code::blocks to work as an arduino IDE

I followed this guide: http://arduinodev.com/guide-to-arduino-development-environment-codeblocks/ Everything seemed to work until I compiled the example code: #include <Arduino.h> /* Turns ...
Diogo Meneses's user avatar
5 votes
3 answers
6k views

Works with gcc, not with Arduino. error: taking address of temporary array

I need to hard code 8 byte addresses into char arrays of length 8. This must be done many places in my code (in function scope), so I have tried to come up with a one-liner. The following works ...
Mads Skjern's user avatar
  • 1,115
0 votes
2 answers
544 views

detecting presence inside - PIR or ultrasound?

(I am professionally a software guy working in the GCC compiler with MELT, so I am fluent in software, but much less in hardware - I did use a solder for a 74LS00 nand gate based stuff in the 1990s. ...
Basile Starynkevitch's user avatar
1 vote
2 answers
526 views

Question about include statements and details in Arduino.h file from core library

This is more of a C/C++ question. However the files I am asking about are a part of the Arduino library. In /arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino/Arduino.h : #ifndef Arduino_h #...
wgwz's user avatar
  • 149
0 votes
1 answer
268 views

Running Arduino code for Bluefruit LE on bare ATMega328

I need to hook up Bluefruit LE Breakout (nRF8001-based) to ATMega328 chip (to use it as wireless UART), and it seems like the library provided is for Arduino. What I have is just bare ATMega328 (note ...
Roman Susi's user avatar
0 votes
1 answer
4k views

How to loop over objects or pass object to function?

I'm not sure if this is more of an C++ question, but I've looked up both and still have no idea. I have a sketch which controls 6 stepper motors using the AccelStepper library and in order to ...
jbyrnes's user avatar
  • 103
3 votes
1 answer
2k views

Using an Arduino board to program an AVR

I think the arduino board is awesome. Though I'm not interested in the library and IDE at all... Is there a way, to use an AVR 328p, as you normally would, on an arduino board? I like how arduino's ...
Paul's user avatar
  • 2,695
1 vote
1 answer
277 views

How to fix error line number offset in Sublime Text when compiling for Arduino

When compiling for Arduino via the Stino plugin line numbers are not represented correctly in the output. For example, I have an error on line 117 however the output is: sketch_name.ino.cpp:136:1: ...
aburdi's user avatar
  • 13
0 votes
1 answer
828 views

Add -D option via boards.txt

I'm trying to find a way to set a -D compiler option from within the boards.txt file. Basically set a #define for use in code. There are already some special ones like board.vid but is there a generic ...
Adam Haile's user avatar
9 votes
3 answers
3k views

How to write makefile-compatible sketches?

I'd like to write my sketches so that I can either build/upload them using the Arduino IDE, or optionally using GCC and a makefile. I know about including the function declarations at the top, but is ...
Alex Shroyer's user avatar
15 votes
1 answer
307 views

Is there a preprocessor constant for memory size

I would like my compiles to exclude some code depending upon the flash/program space available. To be used in the demo code of a library I support. Whereas my current solution is to use a #ifdef of ...
mpflaga's user avatar
  • 2,503