• 締切済み

avr studioのビルドエラーについて

avr studio 6にてプログラミングしようとしている超初心者です 書き込み機器をmkII、atmega328pに書き込もうとしております しかし、エラーが出てしまい、どうしてもビルドが成功できません。 質問なのですが、こちらのサイト(http://www.diotown.com/creative/2011/05/arduino-de-pwm-controller.h...)にて行っているものを そのままプログラミングしてみようと リンクについていたソース(http://www006.upp.so-net.ne.jp/neueziel/pp/powerpack_r.txt) を #include <avr/io.h>からコピーしてビルドしてみました。 ですが、ビルドがエラー15個、警告5個出てしまいました。 そのうちの数か所を記載しますのでどうすればよいかアドバイスよろしくお願いします。 説明 行 列 プロジェクト (1)エラー 1 unknown type name 'byte' 190 1 VVVF (2)エラー 5 'OUTPUT' undeclared (first use in this function) 291 17 VVVF (3)エラー 9 'HIGH' undeclared (first use in this function) 330 20 VVVF (4)エラー 12 'word' undeclared (first use in this function) 582 26 VVVF (5)エラー 13 expected ';' before 'light' 582 31 VVVF (6)エラー 14 'B00010001' undeclared (first use in this function) 583 14 VVVF (7)警告 4 implicit declaration of function 'pinMode' [-Wimplicit-function-declaration]291 2 VVVF (8)警告 7 implicit declaration of function 'swrite' [-Wimplicit-function-declaration]327 4 VVVF (9)警告 8 implicit declaration of function 'digitalWrite' [-Wimplicit-function-declaration]330 3 VVVF (10)警告 10 implicit declaration of function 'delay' [-Wimplicit-function-declaration] 332 3 VVVF (11)警告 11 implicit declaration of function 'analogRead' [-Wimplicit-function-declaration]344 4 VVVF 以上ですよろしくお願いします

みんなの回答

  • plt_
  • ベストアンサー率59% (16/27)
回答No.1

思うに、リンク先の方はArduino IDEを使われてるんじゃないでしょうか? Arduino独特のtypedefや定数が見つからないのでエラーになっているようです。 arduino.hとか引っ張ってきたらビルドは通るかもしれませんが、ちゃんと動作するか??? 私もAtmel StudioとATmega単体しか使ったことないので、「こうすればよい」みたいなものは 示せませんが、ArduinoをAtmel Studioで動作させている例を探すと、何か参考になるかも。 http://junkroom2cyberrobotics.blogspot.jp/2012/07/jtagice3.html

sugityan
質問者

お礼

ありがとうございます、 一回IDEの方で挑戦してみます

関連するQ&A

  • AVRマイコン ビルドエラー

    AVRマイコンを #include <avr/io.h> int main(void) { DDRD =0b11111111; PORTD=0b11111111; } で、ビルドしようとしているのですが、 ../test3.c:0: error: MCU `atmega88p' supported for assembler only と、その後に ../test3.c:5: error: `DDRD' undeclared (first use in this function) 等と、エラーが出てビルド出来ません。 どうすればいいのでしょうか? 回答お願いします。

  • Apache2インストールでpcre_default_tables未定義エラー

    こんにちは、honiyonです。  RedHat LinuxにApache2をソースからインストールしようとしています。  tar xzvf で展開し、   ./configure --enable-modules=so --enable-ssl   make  としたところ、 pcre.c: In function `pcre_compile': pcre.c:2534: `pcre_default_tables' undeclared (first use in this function) pcre.c:2534: (Each undeclared identifier is reported only once  とエラーが出ました。  原因が分からなかったので、pcre-6.3.tar.gz を使って無理やり(?)コンパイルを通すと、今度は util.c: In function `ap_find_token': util.c:1456: `test_char_table' undeclared (first use in this function) util.c:1456: (Each undeclared identifier is reported only once util.c:1456: for each function it appears in.) util.c:1456: `T_HTTP_TOKEN_STOP' undeclared (first use in this function) util.c: In function `ap_escape_shell_cmd': util.c:1520: `test_char_table' undeclared (first use in this function) ...~後略~  とエラーが出ました。  Apacheのバージョンは、2.0.54と2.0.46を試していますが、同じエラーとなっています。  う~ん、何か不足しているのでしょうか?  VineLinuxで同様のmakeをした時はすんなり成功しました。  何かお気づきの点がありましたら、是非ご教示ください。  因みに、このLinuxのunameの結果は uname -s Linux uname -m i686 uname -r 2.4.20-8smp uname -v #1 SMP Thu Mar 13 17:45:54 EST 2004  gcc -v は RedHat Linux 3.2.2-5  です。  宜しくお願いします(..

  • MinGWとmsysでGTK+の開発環境を整えたい

    WindowsXP上で、コンパイラにMinGWを用いてGTK+2.0を用いたGUIアプリケーションの開発を行いたいと思っています。 しかし、GTK+2.0のサンプルソースのコンパイルが通りません。 コマンドとそのエラーは以下の通りです。 どうもヘッダーが見つからないと言っているようですが、ヘッダーをコンパイラのincludeフォルダに入れても駄目でした。 いれたGTK+はGlade等、全てがパックになっているものでした。インストール時にmsysを認識してくれていたので、勝手に設定をしてくれるのかと思ったのですが…。 $ gcc hello_gtk.c 'pkg-config gtk+-2.0 --cflags' hello_gtk.c:1:21: gtk/gtk.h: No such file or directory hello_gtk.c: In function `main': hello_gtk.c:5: error: `GtkWidget' undeclared (first use in this function) hello_gtk.c:5: error: (Each undeclared identifier is reported only once hello_gtk.c:5: error: for each function it appears in.) hello_gtk.c:5: error: `window' undeclared (first use in this function) hello_gtk.c:6: error: `label' undeclared (first use in this function) hello_gtk.c:10: error: `GTK_WINDOW_TOPLEVEL' undeclared (first use in this function) gcc.exe: pkg-config gtk+-2.0 --cflags: No such file or directory どうすれば、コンパイルできるようになるのでしょう?

  • エラーの対策

    インターネット上で他の方のC言語ソースコードをダウンロードした、MAKEでコンパイルしたときに、以下のエラーはでました、どうしたらいいでしょうか? gcc -pipe -ansi -c -o base.o base.c base.c: In function `Setup': base.c:535: `S_IFDIR' undeclared (first use in this function) base.c:535: (Each undeclared identifier is reported only once base.c:535: for each function it appears in.) make: *** [base.o] Error 1

  • コンパイルエラーの原因がわからず困っています。

    こんにちわ。いつもお世話になっております。 自分で構造体を定義して、それを使ってみたのですがコンパイルエラーが出てしまいます。何がいけないのでしょうか。 以下がそのプログラムです。 struct list { struct list *prev; struct in_addr ip_src, ip_dst; u_short th_sport; u_short th_dport; struct list *next; }; void main (u_char * args, const struct pcap_pkthdr *header, const u_char * packet) { static int count = 1; const sturct list *flow; return; } 以上です。 エラー内容は test.c: In function ‘main’: test.c:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘list’ test.c:17: error: ‘list’ undeclared (first use in this function) test.c:17: error: (Each undeclared identifier is reported only once test.c:17: error: for each function it appears in.) test.c:17: error: ‘flow’ undeclared (first use in this function) 以上です。 どんな些細な意見でも構いませんので、何か気が付かれたら教えて頂けないでしょうか。どうぞよろしくお願いします。

  • 【c言語】ファイルの読み込みエラーについて

    自然言語処理について勉強しています。 Wikipediaのdumpデータからタイトルと本文を抜き出して処理をしようと思ってます。 xmlの処理について試しているのですが、エラーに見舞われて困っています。 プログラミングはあまり得意ではないです。 以下にソースコードとエラー部分を貼り付けます。 ご助力お願いします。 ============================ #include <stdlib.h> #include <string.h> int main (){ size_t p; char pb[5]; char line[BUFSIZ]; FILE *fp = fopen("//Wikipediaの分割ファイル//.xml", "r");//xmlファイルのアドレス char title[BUFSIZ]; //FILE *gt=fopen("list_1.txt","r"); FILE *fw = fopen("get_text_c.txt", "w"); if ((NULL == fp)||(NULL== fw )){ printf("aboooooooooooooooooooooooooooot") abort();//終了、ここがうまくいってない? } while (p = ftell(fp), fgets(line, BUFSIZ, fp)) { if (strstr(line, "<title>")){ pb[0] = p;//タイトルの始点 } else if (strstr(line, "</title>")){  pb[3]=p;//タイトルの終点   pb[2]=p-pb[0];//タイトルのバイト数  fprintf(fw, "%zu \t %zu \n", pb[2], pb[3]); //pb2とpb3の観察。  fgets(line,pb2[2],pb[0]);//タイトルを取得  printf("%s",line);//表示  fprintf(fw,"%s",line);//書き込み } else if (strstr(line, "</page>")) {  pb[1] = p - pb[0];  //fwrite(pb, sizeof(size_t), 2, fw); // ...  fprintf(fw, "%zu \t %zu \n", pb[0], pb[1]); //... テキスト形式で観察可能 } } } fclose(fw); fclose(fp); } エラー(ファイル名は get_うぃき.c としてます。) =========================== get_うぃき.c:10:16: warning: declaration of built-in function 'fopen' requires inclusion of the header <stdio.h> [-Wbuiltin-requires-header] get_うぃき.c:11:16: error: use of undeclared identifier 'BUFSIZ' char title[BUFSIZ]; ^ get_うぃき.c:14:5: error: use of undeclared identifier 'FILE' FILE *fw = fopen("get_text_c.txt", "w"); ^ get_うぃき.c:14:11: error: use of undeclared identifier 'fw' FILE *fw = fopen("get_text_c.txt", "w"); ^ get_うぃき.c:15:18: error: use of undeclared identifier 'fp' if ((NULL == fp)||(NULL== fw )){ ^ get_うぃき.c:15:31: error: use of undeclared identifier 'fw' if ((NULL == fp)||(NULL== fw )){ ^ get_うぃき.c:16:13: warning: treating Unicode character <U+FF08> as identifier character rather than as '(' symbol [-Wunicode-homoglyph] printf("aboooooooooooooooooooooooooooot") ^~ get_うぃき.c:16:7: error: use of undeclared identifier 'printf(' printf("aboooooooooooooooooooooooooooot") ^ get_うぃき.c:16:49: warning: treating Unicode character <U+FF09> as identifier character rather than as ')' symbol [-Wunicode-homoglyph] printf("aboooooooooooooooooooooooooooot") ^~ get_うぃき.c:20:16: error: implicit declaration of function 'ftell' is invalid in C99 [-Werror,-Wimplicit-function-declaration] while (p = ftell(fp), fgets(line, BUFSIZ, fp)) { ^ get_うぃき.c:20:27: error: implicit declaration of function 'fgets' is invalid in C99 [-Werror,-Wimplicit-function-declaration] while (p = ftell(fp), fgets(line, BUFSIZ, fp)) { ^ get_うぃき.c:20:39: error: use of undeclared identifier 'BUFSIZ' while (p = ftell(fp), fgets(line, BUFSIZ, fp)) { ^ get_うぃき.c:20:47: error: use of undeclared identifier 'fp' while (p = ftell(fp), fgets(line, BUFSIZ, fp)) { ^ get_うぃき.c:20:12: error: use of undeclared identifier 'p' while (p = ftell(fp), fgets(line, BUFSIZ, fp)) { ^ get_うぃき.c:20:22: error: use of undeclared identifier 'fp' while (p = ftell(fp), fgets(line, BUFSIZ, fp)) { ^ get_うぃき.c:22:15: error: use of undeclared identifier 'p' pb[0] = p;//タイトルの始点 ^ get_うぃき.c:25:7: warning: treating Unicode character as whitespace [-Wunicode-whitespace]  pb[3]=p;//タイトルの終点 ^~ get_うぃき.c:26:6: warning: treating Unicode character as whitespace [-Wunicode-whitespace]   pb[2]=p-pb[0];//タイトルのバイト数 ^~ get_tokuhisa.c:25:16: error

  • ubuntuにxspimをインストールできません

    Linux始めたばかりの初心者です。ディストリビューションはubuntuを使っています。 授業に使っているXSPIMというソフトを自宅のLinuxにも入れようとしています。XSPIMというのはUNIX環境で動くアセンブリ言語のシミュレータです。インストール手順がここ(http://www.cs.wisc.edu/~larus/spim.html) の下の方に載っているのでそれに従っているのですが・・・ 現在手順6.で躓いています、、 6. Then, if you are using Imakefile file, change to the spim-7.2/xspim directory and type: % xmkmf % make If you do not have a copy of xmkmf, you can use the Makefile in the xspim directory, but beware that it may not work on your system because the paths to the X windows libraries could be different. 上記の通りに、spim-7.3/xspimのディレクトリに移動して、xmkmfを実行しようとすると、次のエラーが出てしまいます。 mv -f Makefile Makefile.bak imake -DUseInstalled -I/usr/lib/X11/config <stdin>:1:19: error: stdio.h: No such file or directory <stdin>:2:19: error: ctype.h: No such file or directory <stdin>: In function ‘main’: <stdin>:18: error: ‘NULL’ undeclared (first use in this function) <stdin>:18: error: (Each undeclared identifier is reported only once <stdin>:18: error: for each function it appears in.) <stdin>:45: warning: incompatible implicit declaration of built-in function ‘sscanf’ <stdin>:49: warning: incompatible implicit declaration of built-in function ‘printf’ Aborted (core dumped) 何か余分にインストールしなければならないものがあるんでしょうか? エラーメッセージを見ても何がいけないのか僕ではわからなかったのでここに投稿させていただきました。 よろしくお願いします。

  • gccですが、コンパイルができません!

    以下のプログラムですが #include <stdio.h> int main() { Int col; char i; scanf( "%d", &col ); for( i = 0 ; i < 26 ; i++ ){ if( i > 0 && ( i % col ) == 0 ) printf( "\n" ); printf( "%c", 'a' + i ); } return 0; } 以上のプログラムをgccでコンパイルしました。 コンパイルするために入力した文字→  gcc p.c -o p.exe 以下のエラーがでてコンパイルできません。 p.c: In function `main': p.c:4: error: `Int' undeclared (first use in this function) p.c:4: error: (Each undeclared identifier is reported only once p.c:4: error: for each function it appears in.) p.c:4: error: syntax error before "col" p.c:7: error: `col' undeclared (first use in this function) p.c:17:2: warning: no newline at end of file  以上なぜコンパイルができないのですか? よろしくお願いいたします。

  • gcc(cygwin)でのstd::wstringの利用方法

    gccでstd::wstringを使用すると以下のようなエラーとなり、コンパイルが通りません。gccでのコンパイル方法を教えてください。gccのバージョンは3.4.4です。 error: `wstring' undeclared (first use this function)

  • GPIBドライバIC uPD7210を使用したGPIBカードをFreeBSD7.0(?)で使用するには?

    GPIBドライバIC uPD7210を使用したGPIBカードをFreeBSD7.0(?)で使用するためにネットにあったものを参考に、カーネルを再構築してmakeを実行したところ、errorがたくさん出て困っています。他サイトでも同じ質問をしたのですがあまり回答がないのでこちらでも質問します。 とりあえずネットに書いてあることをそのままやってみてerrorメッセージがなくなるようにいろいろ調べて試しているのですが一向にうまくいきません。どなたかアドバイスをお願いします。卒研で先生にやらされているのですがC言語を授業で少しやったことがある程度なので知識は限りなく乏しいです。しかし、今さらテーマを変えるわけにもいかないのでなんとかしたいのです。 デバイスドライバ等は下記アドレスにあります。 http://www.youko-house.ne.jp/~hirohito/soft/upd7210-2 ver.4.xではうまくいくそうです。目的はgpibを使った計測システム作成なので、最悪ver4を使おうと思うのですがそれでは何もやっていないのとほぼ同じなのでver.7になんとかつっこめないかと思っています。 あとメジャー番号の振り分けも必要なみたいなのですがver.4の場合、/usr/src/sys/conf/majorsに一覧になっているのですがver.7ではmajorsがなくなっていてどこかにあるのかわかりません。 下にエラーメッセージを示します。warningは先生が無視してもいいといったので(ホントかわかりませんが)とりあえずerror:だけ示します。すべてupd7210.cのものです。 78: error: 'nopoll' undeclared here (not in a function) 79: error: 'nommap' undeclared here (not in a function) 80: error: 'nostrategy' undeclared here (not in a function) 83: error: 'nodump' undeclared here (not in a function) 84: error: 'nopsize' undeclared here (not in a function) 134: error: conflicting types for 'gpib_open' 65: error: previous declaration of 'gpib_open' was here In function 'gpib_open': At top level: 160: error: conflicting types for 'gpib_close' 66: error: previous declaration of 'gpib_close' was here In function 'gpib_close': At top level: 187: error: conflicting types for 'gpib_read' 67: error: previous declaration of 'gpib_read' was here In function 'gpib_read': At top level: 254: error: conflicting types for 'gpib_write' 68: error: previous declaration of 'gpib_write' was here In function 'gpib_write': At top level: 314: error: conflicting types for 'gpib_ioctl' 69: error: previous declaration of 'gpib_ioctl' was here In function 'gpib_ioctl': 377: error: label at end of compound statement