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

10 ビュー (過去 30 日間)
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.

採用された回答

Supreeth Subbaraya
Supreeth Subbaraya 2023 年 10 月 11 日
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
  1 件のコメント
zzm oliver
zzm oliver 2023 年 10 月 12 日
Thank you, later on I tried generating dll. And building dll is fine. But thanks anyway! This "packNGo" is really useful!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by