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

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

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

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

C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

Q&A

解決済

1回答

2110閲覧

コンパイルは通るのにビルドできない。

imahh

総合スコア2

C

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

C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

0グッド

0クリップ

投稿2021/12/23 13:05

編集2021/12/23 13:14

前提・実現したいこと

現在MPLAB harmony v3 を用いて加速度センサーからの値をUARTを用いて受信するプログラムを書いています。

発生している問題・エラーメッセージ

c:\program files\microchip\xc32\v3.01\bin\bin\gcc\pic32mx\8.3.1........\bin/pic32m-ld.exe: build/angleanduart/production/_ext/1360937237/main.o:c:/users/name/harmonyprojects/myproject_7/firmware/src/main.c:17: multiple definition of queue_data'; build/angleanduart/production/_ext/633535977/plib_uart1.o:c:/users/tsuku/harmonyprojects/myproject_7/firmware/src/config/angleanduart/peripheral/uart/plib_uart1.c:51: first defined here c:\program files\microchip\xc32\v3.01\bin\bin\gcc\pic32mx\8.3.1........\bin/pic32m-ld.exe: build/angleanduart/production/_ext/1360937237/main.o:c:/users/name/harmonyprojects/myproject_7/firmware/src/main.c:20: multiple definition of enqeue'; build/angleanduart/production/_ext/633535977/plib_uart1.o:c:/users/tsuku/harmonyprojects/myproject_7/firmware/src/config/angleanduart/peripheral/uart/plib_uart1.c:54: first defined here
c:\program files\microchip\xc32\v3.01\bin\bin\gcc\pic32mx\8.3.1........\bin/pic32m-ld.exe: build/angleanduart/production/_ext/1360937237/main.o:c:/users/tsuku/harmonyprojects/myproject_7/firmware/src/main.c:19: multiple definition of queue_num'; build/angleanduart/production/_ext/633535977/plib_uart1.o:c:/users/tsuku/harmonyprojects/myproject_7/firmware/src/config/angleanduart/peripheral/uart/plib_uart1.c:53: first defined here c:\program files\microchip\xc32\v3.01\bin\bin\gcc\pic32mx\8.3.1........\bin/pic32m-ld.exe: build/angleanduart/production/_ext/1360937237/main.o:c:/users/tsuku/harmonyprojects/myproject_7/firmware/src/main.c:18: multiple definition of queue_head'; build/angleanduart/production/_ext/633535977/plib_uart1.o:c:/users/tsuku/harmonyprojects/myproject_7/firmware/src/config/angleanduart/peripheral/uart/plib_uart1.c:52: first defined here
c:\program files\microchip\xc32\v3.01\bin\bin\gcc\pic32mx\8.3.1........\bin/pic32m-ld.exe: Link terminated due to previous error(s).

Info: Loading file: ./..\src\config\angleanduart\p32MK0512MCJ064.ld
collect2.exe: error: ld returned 255 exit status
make[2]: *** [dist/angleanduart/production/angletest.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
nbproject/Makefile-angleanduart.mk:260: recipe for target 'dist/angleanduart/production/angletest.X.production.hex' failed
make[2]: Leaving directory 'C:/Users/name/HarmonyProjects/MyProject_7/firmware/angletest.X'
nbproject/Makefile-angleanduart.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/name/HarmonyProjects/MyProject_7/firmware/angletest.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 1s)

該当のソースコード

Makefile-impl.mkの内容
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a pre- and a post- target defined where you can add customization code.
#
# This makefile implements macros and targets common to all configurations.
#
# NOCDDL

# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
# and .clean-reqprojects-conf unless SUB has the value 'no'
SUB_no=NO
SUBPROJECTS=${SUB_${SUB}}
BUILD_SUBPROJECTS_=.build-subprojects
BUILD_SUBPROJECTS_NO=
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
CLEAN_SUBPROJECTS_=.clean-subprojects
CLEAN_SUBPROJECTS_NO=
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}

# Project Name
PROJECTNAME=angletest.X

# Active Configuration
DEFAULTCONF=angleanduart
CONF=${DEFAULTCONF}

# All Configurations
ALLCONFS=angleanduart

# build
.build-impl: .build-pre
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf

# clean
.clean-impl: .clean-pre
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf

# clobber
.clobber-impl: .clobber-pre .depcheck-impl
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=angleanduart clean

# all
.all-impl: .all-pre .depcheck-impl
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=angleanduart build

# dependency checking support
.depcheck-impl:
# @echo "# This code depends on make tool being used" >.dep.inc
# @if [ -n "${MAKE_VERSION}" ]; then
# echo "DEPFILES=$$(wildcard $$(addsuffix .d, $${OBJECTFILES}))" >>.dep.inc;
# echo "ifneq ($${DEPFILES},)" >>.dep.inc;
# echo "include $${DEPFILES}" >>.dep.inc;
# echo "endif" >>.dep.inc;
# else
# echo ".KEEP_STATE:" >>.dep.inc;
# echo ".KEEP_STATE_FILE:.make.state.$${CONF}" >>.dep.inc;
# fi

Makefile-angleanduart.mkの内容

#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a pre- and a post- target defined where you can add customization code.
#
# This makefile implements macros and targets common to all configurations.
#
# NOCDDL

# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
# and .clean-reqprojects-conf unless SUB has the value 'no'
SUB_no=NO
SUBPROJECTS=${SUB_${SUB}}
BUILD_SUBPROJECTS_=.build-subprojects
BUILD_SUBPROJECTS_NO=
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
CLEAN_SUBPROJECTS_=.clean-subprojects
CLEAN_SUBPROJECTS_NO=
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}

# Project Name
PROJECTNAME=angletest.X

# Active Configuration
DEFAULTCONF=angleanduart
CONF=${DEFAULTCONF}

# All Configurations
ALLCONFS=angleanduart

# build
.build-impl: .build-pre
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf

# clean
.clean-impl: .clean-pre
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf

# clobber
.clobber-impl: .clobber-pre .depcheck-impl
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=angleanduart clean

# all
.all-impl: .all-pre .depcheck-impl
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=angleanduart build

# dependency checking support
.depcheck-impl:
# @echo "# This code depends on make tool being used" >.dep.inc
# @if [ -n "${MAKE_VERSION}" ]; then
# echo "DEPFILES=$$(wildcard $$(addsuffix .d, $${OBJECTFILES}))" >>.dep.inc;
# echo "ifneq ($${DEPFILES},)" >>.dep.inc;
# echo "include $${DEPFILES}" >>.dep.inc;
# echo "endif" >>.dep.inc;
# else
# echo ".KEEP_STATE:" >>.dep.inc;
# echo ".KEEP_STATE_FILE:.make.state.$${CONF}" >>.dep.inc;
# fi

#ってかいてあるのはコメントです。これは自動生成されたプログラムです。

試したこと

UARTの通信を行うコードはuart.cでそれはuart.hにしてあったのでそれに新たに自作のリングバッファーの処理を行う関数を記述し、その関数はmain.cで使用するのでmain.cでも変数を使えるためにuart.hに変数を格納してmain.cでuart.hをincludeしてたのをuart.hも格納してあるdefinitions.hに書いてみました。意味ありませんでした。ほかにもヘッダーに変数を書くのではなくuart1.cで変数を宣言し、main.cで関数をプロトタイプ宣言してみたりしました。
ヘッダーの名前とかは実際にはちがうけどほとんど同じです。

補足情報(FW/ツールのバージョンなど)

xc32 3.01
harmony 最新
mplab 5.50

ここにより詳細な情報を記載してください。

https://17.gigafile.nu/1230-dfeedc2df2a26d004f7b45990e44a5dba
一応書いたソースコードをギガファイル便にまとめました。
長く残らないのですが.....

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

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

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

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

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

guest

回答1

0

ベストアンサー

/main.c:17: multiple definition of queue_data'

多重定義のエラーです
エラーの場所も示されてるので、そこを参照しましょう

投稿2021/12/23 13:36

y_waiwai

総合スコア87800

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

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

imahh

2021/12/23 14:49

色々な所で何度も同じ変数や関数が定義されてました。 ありがとうごさまいます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.46%

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

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

質問する

関連した質問