go_away

Author Topic: request suggestion in basic c code [ post #18]  (Read 2539 times)

0 Members and 1 Guest are viewing this topic.

Offline strifTopic starter

  • Jr. Member
  • **
  • Posts: 47
  • Helpful? 0
Re: request suggestion in basic c code [ post #18]
« Reply #30 on: April 03, 2012, 03:29:09 AM »
gcc is the compiler. Everything will work fine until you need to compile your code into a .hex file.

Did you install WinAVR?

Dear Admin,

yes, I have WinAVR-20100110 in my windows program file

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,657
  • Helpful? 169
    • Society of Robots
Re: request suggestion in basic c code [ post #18]
« Reply #31 on: April 03, 2012, 03:36:49 AM »
What version of WebbotLib are you using?

Offline strifTopic starter

  • Jr. Member
  • **
  • Posts: 47
  • Helpful? 0
Re: request suggestion in basic c code [ post #18]
« Reply #32 on: April 03, 2012, 04:29:27 AM »
I am using webbotavrclib-2.08

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,657
  • Helpful? 169
    • Society of Robots
Re: request suggestion in basic c code [ post #18]
« Reply #33 on: April 03, 2012, 04:35:43 AM »
I almost feel as if your makefile is somehow corrupted.

1) Close out AVR Studio.

2) Open up your project Project Designer

3) Have it run Generate

4) Open up your project in AVR Studio

5) try compiling again

Offline strifTopic starter

  • Jr. Member
  • **
  • Posts: 47
  • Helpful? 0
Re: request suggestion in basic c code [ post #18]
« Reply #34 on: April 03, 2012, 04:57:24 AM »
I almost feel as if your makefile is somehow corrupted.

1) Close out AVR Studio.

2) Open up your project Project Designer

3) Have it run Generate

4) Open up your project in AVR Studio

5) try compiling again

I try make a simple code step by step

Open up project designer

assign the pin_out

save in a new project folder

generate it

open AVR studio 4 , open the project folder

write a simple output code and compile it.

Code: [Select]
rm -rf *.o dep/* lib/*.o lib/*.a code_7.elf example.txt 
rm -rf code_7.lst code_7.map code_7.hex code_7_eeprom.hex *.bin *.srec
Build succeeded with 0 Warnings...
g++  -g -Wall -DF_CPU=16000000 -mmcu=atmega640 -gdwarf-2 -fpack-struct -fshort-enums  -funsigned-char -funsigned-bitfields -I"../../../../AxonII_2/webbotavrclib-2.08"  -MD -MP -MT code_7_main.o -MF dep/code_7_main.o.d -fno-threadsafe-statics  -c -o code_7_
main.o code_7_main.cpp

/usr/bin/sh: g++: command not found
make: *** [code_7_main.o] Error 127
Build failed with 1 errors and 0 warnings...


Offline strifTopic starter

  • Jr. Member
  • **
  • Posts: 47
  • Helpful? 0
Re: request suggestion in basic c code [ post #18]
« Reply #35 on: April 03, 2012, 05:02:14 AM »
maybe I should test write new code (start from 0) on another pc ?

Offline strifTopic starter

  • Jr. Member
  • **
  • Posts: 47
  • Helpful? 0
Re: request suggestion in basic c code [ post #18]
« Reply #36 on: April 03, 2012, 05:29:36 AM »



Am I made a mistake?  my own code  int main() { }  should put inside => Source Files => Code_2.cpp or save a new file as the Code_2_main.cpp else should not put inside the Source Files ? Sorry that I am asking stupid question because I just touch with AVR Studio 4 with Axon II. 

my Code_2_main.cpp have including. Any mistake I made ?
Code: [Select]
#include "hardware.h"
#include "lib_ctor.h"
#include "lib_iopins.h"
#include "lib_timerdef.h"
#include "Code_2.cpp"
#include "gen_clock.c"
#include "gen_StepMotor.c"
#include "lib_hardware.c"
#include "lib_iopins.c"
#include "lib_timerdef.c"
#include "lib_timers.c"
#include "opt_DeviceName.c"
#include "opt_pcint.c"
#include "opt_scheduler.c"
#include "opt_TimerCapture.c"
#include "opt_TimerCompare.c"
#include "opt_TmerOverflow.c"


Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,657
  • Helpful? 169
    • Society of Robots
Re: request suggestion in basic c code [ post #18]
« Reply #37 on: April 03, 2012, 09:53:04 AM »
Create one more new project with Project Designer.

Open up the AVR Studio file. Don't change anything.

Compile the code.


----------

If that still doesn't work, uninstall WinAVR completely. Remove all traces of it, all folders, all files. Then re-install again.

----------

If that still doesn't work, uninstall AVR Studio completely. Remove all traces of it, all folders, all files. Then re-install again.



I'm having you do this because I feel a path got corrupted somewhere.

Offline strifTopic starter

  • Jr. Member
  • **
  • Posts: 47
  • Helpful? 0
Re: request suggestion in basic c code [ post #18]
« Reply #38 on: April 04, 2012, 02:56:05 PM »
After I uninstall all of those program and re-install .

I get those error

Code: [Select]
Code_2.cpp:36: error: 'low' was not declared in this scope
Code_2.cpp:41: warning: suggest parentheses around assignment used as truth value
Code_2.cpp:43: error: expected initializer before 'Getus'
Code_2.cpp:47: error: 'open' was not declared in this scope
Code_2.cpp:49: error: 'Getus' was not declared in this scope
Code_2.cpp:49: error: 'start_time' was not declared in this scope
Code_2.cpp:52: error: 'DRIVER_SPEED_MIN' was not declared in this scope
Code_2.cpp:68: error: 'isHigh' was not declared in this scope
Code_2.cpp:72: error: 'low' was not declared in this scope


Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,657
  • Helpful? 169
    • Society of Robots
Re: request suggestion in basic c code [ post #18]
« Reply #39 on: April 08, 2012, 08:48:56 PM »
I still think you missed an important step in installing WebbotLib. You probably have a pathname misconfigured for WebbotLib, or have a space in the path name.

Tell us exactly where on your computer you have your project saved, and also where you have WebbotLib saved.



Also, read through this and double check you did everything right:
http://societyofrobots.com/axon_mote/axon_mote_setup1.shtml

 


Get Your Ad Here