Four unresolved external symbol when generating static library for function "pcdownsample"

1 view (last 30 days)
Steps to reproduce:
1. Write simple function which just wrap a call to the cv toolbox function "pcdownsample"
2. Write a simple script that calls the function. The script refered to the first example of the help page of the "pcdownsample".
3. Use Coder app, specify "mypcdownsample" as the function to be translated, specify "run_mypcdownsample" as the running code to define input types. Modify the input type to "inf×3" and choose c++ static library as the wanted build type. Select "vs 2019 project | cmake 64-bit" as the toolchain. Below are snapshots of the matlab coder:
4. Open the sln, create a new project, add the auto-generated example files(main.h main.cpp) to this project. Replace the trivial init function with my own correct function which reads the "teapot.txt" file. Also add some folders to the "additional include directories" so that vs could find the headers.
5. Build the solution. VS complained about "unresolved external symbol", both in "debug" and "release" mode.

Accepted Answer

Supreeth Subbaraya
Supreeth Subbaraya on 11 Oct 2023
This issue is because a few of the libraries required are not linked. Here is a workaround you can try to resolve the issue:
Obtain the required files and libraries using the packNGo function. This creates a .zip folder with all the files required
  1. Load the buildInfo.mat from the 'codegen' directory, into your workspace
  2. >> packNGo(buildInfo)
Extract the files and in your visual studio and then configure the linker settings.
  1. In solution explorer at the right side, right click on your project, then click properties
  2. Go to, Linker -> General, add the packNGo Folder to the "Additional Library Directories"
  3. Go to, Linker -> Input, add the required libraries as additional dependencies. Add the libraries mypcdownsample.lib, libmwkdtree.lib and libmwvoxelGridFilter.lib (see below screenshot as reference)
Hope this resolves the issue

More Answers (0)

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!