Including C/C++ generated code in CodeBlocks project

5 views (last 30 days)
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

Accepted Answer

Adithya
Adithya on 24 Apr 2023
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.

More Answers (0)

Categories

Find more on Schedule Model Components in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!