Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Programming Questions & Help >> Syntax >> Direct compiling C++ and upload
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1210157683

Message started by julienb on 05/07/08 at 10:54:43

Title: Direct compiling C++ and upload
Post by julienb on 05/07/08 at 10:54:43
hello,

newbie question:

If I want to directly code in C++, how could I do?

I understand that :
you code in wiring language
you click run, wiring environment translate your code in C++

but How can i do directly that and upload it on the board?


Title: Re: Direct compiling C++ and upload
Post by worapoht on 05/07/08 at 17:57:57
umm.. can you explain more about "direct code" is..
because Wiring base on AVRGCC that are C/C++ itself

Wiring add built-in libraries and prepare init(); setup(); and loop(); in real main();

you still write code refer to register like this,
DDRB|=0x01;
PORTB&=0xfe;

or may define your own class items,
class demo
{
public:
 unsigned char write(unsigned char i)
 {
   return ++i;
 }
};

prototype overload function, etc.. that's work as I write on Eclipse C/C++ wtih AVR plugins

what's are u looking for?

Title: Re: Direct compiling C++ and upload
Post by julienb on 05/07/08 at 18:03:52
I mean:
when I code stuff in Wiring environment, and click on run, it creates an "applet" directory with, inside, a pretty *.cpp file

this is C++ code.
with include *.h etc

can I do that directly in Wiring environment ? or do I have to code in Wiring environment, click on run, and modify the *.cpp file?

in the second case, how could I  compile *.cpp in order to make a *.hex and how could I send the *.hex to the board?

Title: Re: Direct compiling C++ and upload
Post by worapoht on 05/08/08 at 08:34:12
I see..

direct main code C/C++ .c/.cpp format or have main() not allow on Wiring.
because Wiring known only .pde as current sketch and combine into "real" main.c and compile later..
just .cpp , .h as library can be added <#include  ...>

for second question, "Verify" is pre-compile check and not generate new .hex file.
for .hex upload, on now, you need to run individual command line to upload .hex using avrdude command with some parameter (for WiringV1 using uisp instead)

Why do you need something hard-way like that?
Wiring do less and get work already..

one good reason for .pde is unique type, it's run on known platform/hardware Wiring (or Arduino) that user just write code and run.. no hugh project setup need on C/C++ project that may trouble on user..

Wiring call source file as "Sketch" and save in ".pde" for relate to Processing in the same environment.

for better answer, you may ask Barragan H.  :)

Title: Re: Direct compiling C++ and upload
Post by julienb on 05/08/08 at 08:52:59
hello worapoht,

I don't need it now.
I just wanted to understand how it works.

indeed, I'm and I'll be a *.pde coder (processing & wiring!)
this environment is here to help us  ;)

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.