C++ compiler produced errors

3 次查看(过去 30 天)
chan yeoung woo
chan yeoung woo 2021-9-27
回答: Lokesh 2024-3-19
how can i solve this problem?
i install__MATLAB Support for MinGW-w64 C/C++ Compiler
i use R2021a
>> deploy(board,'raspi_fileRead_resnet')
Deploying code. This may take a few minutes.
------------------------------------------------------------------------
Error executing command "touch -c /home/pi/MATLAB_ws/R2021a/C/Users/CODLab-DHKim/Documents/MATLAB/Examples/R2021a/raspberrypiio/ClassifyImageOnRaspberryPiViaSSHWithResNet50AndOpenCVExample/codegen/exe/raspi_fileRead_resnet/*.*;make -f raspi_fileRead_resnet_rtw.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2021a" -C /home/pi/MATLAB_ws/R2021a/C/Users/CODLab-DHKim/Documents/MATLAB/Examples/R2021a/raspberrypiio/ClassifyImageOnRaspberryPiViaSSHWithResNet50AndOpenCVExample/codegen/exe/raspi_fileRead_resnet". Details:
STDERR: /home/pi/MATLAB_ws/R2021a/C/Users/CODLab-DHKim/Documents/MATLAB/Examples/R2021a/raspberrypiio/ClassifyImageOnRaspberryPiViaSSHWithResNet50AndOpenCVExample/codegen/exe/raspi_fileRead_resnet/main.cpp:84:5: error: conflicting declaration of C function ‘int main(int, const char* const*)’
int main(int argc, const char * const argv[])
^~~~
In file included from /home/pi/MATLAB_ws/R2021a/C/Users/CODLab-DHKim/Documents/MATLAB/Examples/R2021a/raspberrypiio/ClassifyImageOnRaspberryPiViaSSHWithResNet50AndOpenCVExample/codegen/exe/raspi_fileRead_resnet/main.cpp:38:
/home/pi/MATLAB_ws/R2021a/C/Users/CODLab-DHKim/Documents/MATLAB/Examples/R2021a/raspberrypiio/ClassifyImageOnRaspberryPiViaSSHWithResNet50AndOpenCVExample/codegen/exe/raspi_fileRead_resnet/main.h:48:12: note: previous declaration ‘int main(int, char**)’
extern int main(int argc, char **argv);
^~~~
make: *** [raspi_fileRead_resnet_rtw.mk:488: main.cpp.o] Error 1

回答(1 个)

Lokesh
Lokesh 2024-3-19
Hi chan,
As per my understanding, you are encountering an error due to mismatch in the declaration of 'main' function between 'main.cpp' file and 'main.h' header file.
To resolve this issue, you need to ensure that the declaration of 'main' function in 'main.h' file matches its definition in 'main.cpp' file, particularly regarding the 'const' qualifier for 'argv' parameter.The original declaration in 'main.h' is 'extern int main(int argc, char **argv);' which conflicts with the definition in 'main.cpp' that uses 'const char * const argv[]'.
Please refer to the following steps to resolve the issue:
  • Open the 'main.h' file and locate the declaration of 'main' function.
  • Modify the declaration to "extern int main(int argc, const char * const argv[]);" . Correcting the declaration in 'main.h' to 'extern int main(int argc, const char * const argv[]);' ensures that the the declaration matches its definition.
  • Save the changes and recompile to check if the issue has been resolved.
I hope this helps you in resolving the issue.

类别

Help CenterFile Exchange 中查找有关 C Shared Library Integration 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by