質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.51%
C

C言語は、1972年にAT&Tベル研究所の、デニス・リッチーが主体となって作成したプログラミング言語です。 B言語の後継言語として開発されたことからC言語と命名。そのため、表記法などはB言語やALGOLに近いとされています。 Cの拡張版であるC++言語とともに、現在世界中でもっとも普及されているプログラミング言語です。

Q&A

0回答

7406閲覧

PICマイコンのビルドエラー

lefirea

総合スコア17

C

C言語は、1972年にAT&Tベル研究所の、デニス・リッチーが主体となって作成したプログラミング言語です。 B言語の後継言語として開発されたことからC言語と命名。そのため、表記法などはB言語やALGOLに近いとされています。 Cの拡張版であるC++言語とともに、現在世界中でもっとも普及されているプログラミング言語です。

0グッド

0クリップ

投稿2017/06/20 11:36

編集2022/01/12 10:55

###前提・実現したいこと
MPLAB X v3.61とXC8コンパイラv1.42を使って、PIC16F1938にLチカをしたい。

###発生している問題・エラーメッセージ
調べていくうちに、Leaving directory や No rule to make target が問題だと分かったが、そ解決には至らなかった。

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf make[1]: Entering directory 'C:/Users/user/Desktop/sample.X' make -f nbproject/Makefile-default.mk dist/default/production/sample.X.production.hex make[2]: Entering directory 'C:/Users/user/Desktop/sample.X' make[2]: *** No rule to make target 'build/default/production/newfile.o', needed by 'dist/default/production/sample.X.production.hex'. Stop. make[2]: Leaving directory 'C:/Users/user/Desktop/sample.X' make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2 nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed make[1]: Leaving directory 'C:/Users/user/Desktop/sample.X' nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed BUILD FAILED (exit value 2, total time: 425ms)

###該当のソースコード

c++

1#include <xc.h> 2 3// PIC16F1938 Configuration Bit Settings 4 5// 'C' source line config statements 6 7// CONFIG1 8#pragma config FOSC = ECH // Oscillator Selection (ECH, External Clock, High Power Mode (4-32 MHz): device clock supplied to CLKIN pin) 9#pragma config WDTE = ON // Watchdog Timer Enable (WDT enabled) 10#pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled) 11#pragma config MCLRE = ON // MCLR Pin Function Select (MCLR/VPP pin function is MCLR) 12#pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled) 13#pragma config CPD = OFF // Data Memory Code Protection (Data memory code protection is disabled) 14#pragma config BOREN = ON // Brown-out Reset Enable (Brown-out Reset enabled) 15#pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin) 16#pragma config IESO = ON // Internal/External Switchover (Internal/External Switchover mode is enabled) 17#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled) 18 19// CONFIG2 20#pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off) 21#pragma config VCAPEN = OFF // Voltage Regulator Capacitor Enable (All VCAP pin functionality is disabled) 22#pragma config PLLEN = ON // PLL Enable (4x PLL enabled) 23#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset) 24#pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.) 25#pragma config LVP = ON // Low-Voltage Programming Enable (Low-voltage programming enabled) 26 27// #pragma config statements should precede project file includes. 28// Use project enums instead of #define for ON and OFF. 29 30void setup(void){ 31 OSCCON=0b01110010; 32 TRISA=0b10000000; 33} 34 35void main(void){ 36 setup(); 37 38 if(RA6==0){RA7=0;} 39 else if(RA0==1){RA1=1;} 40}

###試したこと
他の質問サイトの回答で提示されていた下記のページの内容を試した。外国の質問サイトに上がっている、同じようなエラーに対する投稿も見てみたが、解決には至らなかった(自分が読み込みきれていない可能性あり)。

・提示されていたページ
http://microchipdeveloper.com/mplabx:no-rule-to-make-target

###補足情報(言語/FW/ツール等のバージョンなど)
OSはwindows10。
コンパイラをHI-TECH PICCに変えて、コードもそれ用に修正したらちゃんとコンパイルできた。が、xc8を使う必要があるため、これではダメ。

makefileの中身も公開したほうが良い、と言われたので追加します。なお、これは自分で書いたものではなくMPLABの方で自動生成されたものです。

Makefile

1# 2# There exist several targets which are by default empty and which can be 3# used for execution of your targets. These targets are usually executed 4# before and after some main targets. They are: 5# 6# .build-pre: called before 'build' target 7# .build-post: called after 'build' target 8# .clean-pre: called before 'clean' target 9# .clean-post: called after 'clean' target 10# .clobber-pre: called before 'clobber' target 11# .clobber-post: called after 'clobber' target 12# .all-pre: called before 'all' target 13# .all-post: called after 'all' target 14# .help-pre: called before 'help' target 15# .help-post: called after 'help' target 16# 17# Targets beginning with '.' are not intended to be called on their own. 18# 19# Main targets can be executed directly, and they are: 20# 21# build build a specific configuration 22# clean remove built files from a configuration 23# clobber remove all built files 24# all build all configurations 25# help print help mesage 26# 27# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and 28# .help-impl are implemented in nbproject/makefile-impl.mk. 29# 30# Available make variables: 31# 32# CND_BASEDIR base directory for relative paths 33# CND_DISTDIR default top distribution directory (build artifacts) 34# CND_BUILDDIR default top build directory (object files, ...) 35# CONF name of current configuration 36# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) 37# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) 38# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) 39# CND_PACKAGE_DIR_${CONF} directory of package (current configuration) 40# CND_PACKAGE_NAME_${CONF} name of package (current configuration) 41# CND_PACKAGE_PATH_${CONF} path to package (current configuration) 42# 43# NOCDDL 44 45 46# Environment 47MKDIR=mkdir 48CP=cp 49CCADMIN=CCadmin 50RANLIB=ranlib 51 52 53# build 54build: .build-post 55 56.build-pre: 57# Add your pre 'build' code here... 58 59.build-post: .build-impl 60# Add your post 'build' code here... 61 62 63# clean 64clean: .clean-post 65 66.clean-pre: 67# Add your pre 'clean' code here... 68# WARNING: the IDE does not call this target since it takes a long time to 69# simply run make. Instead, the IDE removes the configuration directories 70# under build and dist directly without calling make. 71# This target is left here so people can do a clean when running a clean 72# outside the IDE. 73 74.clean-post: .clean-impl 75# Add your post 'clean' code here... 76 77 78# clobber 79clobber: .clobber-post 80 81.clobber-pre: 82# Add your pre 'clobber' code here... 83 84.clobber-post: .clobber-impl 85# Add your post 'clobber' code here... 86 87 88# all 89all: .all-post 90 91.all-pre: 92# Add your pre 'all' code here... 93 94.all-post: .all-impl 95# Add your post 'all' code here... 96 97 98# help 99help: .help-post 100 101.help-pre: 102# Add your pre 'help' code here... 103 104.help-post: .help-impl 105# Add your post 'help' code here... 106 107 108 109# include project implementation makefile 110include nbproject/Makefile-impl.mk 111 112# include project make variables 113include nbproject/Makefile-variables.mk 114

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

mugicya

2017/06/20 13:16

Leaving directory はともかく、No rule to make target は、makefile の記述ミスである可能性が高いので、makefile も提示すれば解答が得やすくなると思います。
lefirea

2017/06/20 14:15

makefileの中身を追加しました
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.51%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問