Including C/C++ generated code in CodeBlocks project

5 次查看(过去 30 天)
Greeting everyone,
I have an Issue that might be very easy but i can't seem to fix it.
I have generated code from simulink to a simple model (i tried with grt.tlc and ert.tlc syatem targets and with punch of other options) and when i tried to use the generated code and after including all neccesary files in my pre-existing project in Code Blocks, I always get this error when i try to build the project:
c:\program files\codeblocks\mingw_winlibs\bin\..\lib\gcc\i686-w64-mingw32\10.3.0\..\..\..\..\i686-w64-mingw32\bin\ld.exe: obj32\release\src\VirtualComponent1.o:VirtualComponent1.cpp|| undefined reference to `ComputingMdoule_step()'|
||error: ld returned 1 exit status|
However I still can use and manuiplate all variables and structs and everything within the included files! it's only an issue when I try to call any function.
Can anyone help me please.
Thank you a lot

采纳的回答

Adithya
Adithya 2023-4-24
The error message you are seeing indicates that the linker is unable to find a reference to the ComputingModule_step() function, which is likely defined in one of your source files or libraries. This could be due to a few different reasons:
  1. The function is defined in a source file or library that is not being included in the build process. Make sure that all necessary source files and libraries are included in your Code Blocks project.
  2. The function is defined in a source file that is not being compiled. Make sure that the source file containing the function definition is added to the build targets in Code Blocks.
  3. The function name or signature is not correct. Check that the function name and signature match exactly between the declaration and implementation in your code.
If you can use and manipulate all variables and structs without any issues, but the problem occurs only when you try to call a function, then it is likely that the issue is related to the function declaration or definition. Here are a few possible reasons why you might be encountering this issue:
  1. Verify that the function is defined and declared correctly in your code.
  2. Check that the function is included in the build targets and that all necessary source files and libraries are included.
  3. Check for any spelling or case mismatches in the function name or signature.
  4. If you are using a library that contains the function, make sure that you have linked the library correctly in your Code Blocks project.
  5. Try using a different linker or compiler, as the issue could be related to a specific toolchain or configuration.
Hopefully one of these steps will help you resolve the issue.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by