How do I use C++ to code the Arduino boards?

"How do I only use avr-gcc?"

In the IDE, open File:Preferences and turn on Verbose outputs.
Compile a simple sketch.
You will see all the commands that are being executed, some of which are the avr-gcc commands.
Copy & save those, experiment with running them with the avr-gcc environment.

https://www.google.com/search?source=hp&ei=JkEbWq_AHeSLjwS2uI-YDg&q=avr-gcc+download&oq=avr-gcc&gs_l=psy-ab.1.8.0l10.666.3053.0.7143.7.7.0.0.0.0.180.800.4j3.7.0....0...1.1.64.psy-ab..0.7.799...0i131k1.0.HYhD82OxFnM