Visual Studio 2010 Configuration to run PCL Project - visual-studio-2010

I have a problem when trying to debug a simple PCL (Point-Cloud-Library Application) application in MS Visual C++ 2010 that has to visualize a point cloud. (This example: http://pointclouds.org/documentation/tutorials/pcl_visualizer.php)
I setup the C++ project with all the include and library folders needed for PCL.
I add to the linker input the following dependencies:
openNI.lib
libboost_system-vc100-mt-gd-1_49.lib
libboost_filesystem-vc100-mt-gd-1_49.lib
libboost_thread-vc100-mt-gd-1_49.lib
libboost_date_time-vc100-mt-gd-1_49.lib
libboost_iostreams-vc100-mt-gd-1_49.lib
pcl_common_debug.lib pcl_apps_debug.lib
pcl_features_debug.lib
pcl_filters_debug.lib
pcl_io_debug.lib
pcl_io_ply_debug.lib
pcl_kdtree_debug.lib
pcl_keypoints_debug.lib
pcl_octree_debug.lib
pcl_registration_debug.lib
pcl_sample_consensus_debug.lib
pcl_search_debug.lib
pcl_segmentation_debug.lib
pcl_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib
vtkRendering-gd.lib
QVTK-gd.lib
vtkalglib-gd.lib
vtkCharts-gd.lib
vtkCommon-gd.lib
vtkDICOMParser-gd.lib
vtkexoIIc-gd.lib
vtkexpat-gd.lib
vtkFiltering-gd.lib
vtkfreetype-gd.lib
vtkftgl-gd.lib
vtkGenericFiltering-gd.lib
vtkGeovis-gd.lib
vtkGraphics-gd.lib
vtkhdf5-gd.lib
vtkHybrid-gd.lib
vtkImaging-gd.lib
vtkInfovis-gd.lib
vtkIO-gd.lib
vtkjpeg-gd.lib
vtklibxml2-gd.lib
vtkmetaio-gd.lib
vtkNetCDF_cxx-gd.lib
vtkNetCDF-gd.lib
vtkpng-gd.lib
vtkproj4-gd.lib
vtksqlite-gd.lib
vtksys-gd.lib
vtktiff-gd.lib
vtkverdict-gd.lib
vtkViews-gd.lib
vtkVolumeRendering-gd.lib
vtkWidgets-gd.lib
vtkzlib-gd.lib
OpenGL32.Lib
When i start debugging the IDE ends up with the following link error:
LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc100-mt-sgd-1_49.lib'
The library "libboost_thread-vc100-mt-sgd-1_49.lib" is not contained in the set of boost library of the 3party folder of PCL. What am I doing wrong? Is there another path for VS2010 configuration for PCL programs?
Additional information:
I downloaded last version 1.6 of PCL, choosing the MSVC2010 version all-in-one.
I set up the code generation with /MTd (Multi-threaded debug)
I'm running the project with debug mode.

You already got libboost_thread-vc100-mt-gd-1_49.lib so enable your project to use dynamic linking in "configuration properties".
Another option is to download Boost and build it using static linking to generate the libboost_thread-vc100-mt-sgd-1_49.lib file. Don't forget to set the folder of "Linker" -> "Additional Library directories" to the location of the file.

Related

Publish a Windows Application Package Project via command line

How can I publish the UWP package via command line?
I have a WPF application that is packaged with a Windows Application Package Project that ends up being published to the Microsoft Store.
In order to be accepted in the Store, the WPF project needs to be compiled with a preprocessor directive (that I named as "UWP"), deactivating stuff that are not allowed for Store apps.
I'm in the process of migrating the WPF app from .NET Framework 4.8 to .NET 5 and along with that I'm trying to streamline my publishing process via command line.
Is there any way to configure or update the package to support ARM64?
The app will be published outside the Store as x86, x64 and ARM64 and I intend to do the same for the Store version.
When checking the WAPP, I noticed that ARM64 is not available on the list. As you can see in the screenshot, I was able to create a ARM64 build profile, but the architecture is not available on the table.
What have I tried? (Command line issue)
I tried running this command:
MSBuild.exe C:\Project-UWP\Project.UWP\Project.UWP.wapproj /p:DefineConstants=UWP /p:Configuration=Release;AppxBundle=Always;AppxBundlePlatforms="x86|x64|ARM64" /p:OutDir="..\Publish\UWP"
But got these errors:
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 29/09/2021 22:09:19.
Project "C:\Project-UWP\Project.UWP\Project.UWP.wapproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1718,5): warning NU1702: ProjectReference 'C:\Project\Project.csproj' was resolved using '.NETCoreApp,Version=v6.0' instead of the project target framework '.NETFramework,Version=v4.5.1'. This project may not be fully compatible with your project. [C:\Project-UWP\Project.UWP\Project.UWP.wapproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1718,5): warning NU1702: ProjectReference 'C:\Project\Project.csproj' was resolved using '.NETCoreApp,Version=v6.0' instead of the project target framework '.NETFramework,Version=v4.5.1'. This project may not be fully compatible with your project. [C:\Project-UWP\Project.UWP\Project.UWP.wapproj]
_ResolveVCLibDependencies:
Searching for SDKs targeting "UAP, 10.0.20348.0".
Project "C:\Project-UWP\Project.UWP\Project.UWP.wapproj" (1) is building "C:\Project\Project.csproj" (2:9) on node 1 (publish target(s)).
C:\Program Files\dotnet\sdk\5.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1047: Assets file 'C:\Project\Project\obj\project.assets.json' doesn't have a target for 'net5.0-windows/win-x86'. Ensure that restore has run and that you have included 'net5.0-windows' in the TargetFrameworks for your project. You may also need to include 'win-x86' in your project's RuntimeIdentifiers. [C:\Project\Project.csproj]
Done Building Project "C:\Project\Project.csproj" (publish target(s)) -- FAILED.
Done Building Project "C:\Project-UWP\Project.UWP\Project.UWP.wapproj" (default targets) -- FAILED.
Build FAILED.
"C:\Project-UWP\Project.UWP\Project.UWP.wapproj" (default target) (1) ->
(_GetProjectReferenceTargetFrameworkProperties target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1718,5): warning NU1702: ProjectReference 'C:\Project\Project.csproj' was resolved using '.NETCoreApp,Version=v6.0' instead of the project target framework '.NETFramework,Version=v4.5.1'. This project may not be fully compatible with your project. [C:\Project-UWP\Project.UWP\Project.UWP.wapproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1718,5): warning NU1702: ProjectReference 'C:\Project\Project.csproj' was resolved using '.NETCoreApp,Version=v6.0' instead of the project target framework '.NETFramework,Version=v4.5.1'. This project may not be fully compatible with your project. [C:\Project-UWP\Project.UWP\Project.UWP.wapproj]
"C:\Project-UWP\Project.UWP\Project.UWP.wapproj" (default target) (1) ->
"C:\Project\Project.csproj" (publish target) (2:9) ->
(ResolvePackageAssets target) ->
C:\Program Files\dotnet\sdk\5.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1047: Assets file 'C:\Project\obj\project.assets.json' doesn't have a target for 'net5.0-windows/win-x86'. Ensure that restore has run and that you have included 'net5.0-windows' in the TargetFrameworks for your project. You may also need to include 'win-x86' in your project's RuntimeIdentifiers. [C:\Project\Project.csproj]
2 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.31
Notice that there are warnings related to framework references:
ProjectReference C:\Project\Project.csproj was resolved using .NETCoreApp,Version=v6.0 instead of the project target framework .NETFramework,Version=v4.5.1.
This project may not be fully compatible with your project. Microsoft.Common.CurrentVersion.targets 1719
The WPF project was set to use .NET 5, so I don't see why there's any reference to .NETCoreApp 6 or .NET Framework 4.5.1.
What have I tried? (Missing ARM64 issue)
I created a WAPP from scratch and saw that the option for ARM64 appeared in the architecture table.
But when publishing manually via the context menu, I'll get this error:
The specified RuntimeIdentifier 'win-ARM64' is not recognized.

link to gpgme library in Visual Studio

I found this old post:
Using the gpgme library from .NET?
but it can't help me to link my C++ project (Visual Studio) to libgpgme-11.dll.
I am using Windows 10 platform, and have done the followings to try to set it up:
Properties->Linker->Input: libgpgme-11.dll
Properties->Linker->Additional Library Directories: Gpg4win\lib and Gpg4win\bin_64
Properties->C/C++ General->Additional Include Directories: Gpg4win\include
When I compiled the project, I got an Link error LNK1107 invalid or corrupt file: can not read at 0x368.
It seems to me that the libgpgme-11.dll is not the correct one to link against. Yet, I don't find any gpgme lib files under the root Gpg4win folder.
Any recommendation ?
Eric
There are three things to do in setting gpgme in Visual Studio:
Add "Gpg4win\include" to the "Additional Include Directories" property
Add "Gpg4win\bin and Gpg4win\lib" to the "Additional Library Directories" property
Add "libgpgme.imp" to the "Additional Dependencies" property
The Additional Library Directories and Additional Dependencies properties are under Linker's General and Input tabs. The Additional Include Directories property is under C/C++ General tab.
Hope this saves someone else's time.

How to turn off a project for Debug config in CMake-generated Visual Studio solution

Right-click on the solution title in the Solution Explorer window, then go to Configuration Properties -> Configuration. The table appears, showing check-boxes, allowing to turn off/on a build of particular projects for certain configurations.
My solution and projects are generated with CMake.
Is it possible to turn off a particular project for Debug build configuration from CMakeLists.txt?
==
Background of a problem is failing build of Cython project for Debug config.
Release builds fine. CMake module was taken from this example on Github.
Debug config wants debug Python library python27_d.lib, that is forced by pyconfig.h. I use Anaconda python, which is missing this library.
Moreover, I don't need debug build of that project. I've unsuccessfully spent several hours, modifying CMakeLists.txt in various ways, trying to remove definition of _DEBUG macro from compiler command line. CLI parameter /D_DEBUG was absent in all dialogs with properties and "complete command line" listings, that Visual Studio has shown me. Nevertheless, something has always appended it.
So, I'd like to simply disable this project in Debug build for now.
This sets that check-box from the first part of the question to unchecked state:
set_property(TARGET <my Cython module>
PROPERTY EXCLUDE_FROM_DEFAULT_BUILD_DEBUG TRUE)
Now I wonder, where did compiler command line come from, because /D_DEBUG was absent in all dialogs with properties, that Visual Studio has shown me (second part of the question).
I am building this project in VS2013. Initially, that string /D_DEBUG was present in Project properties -> C/C++ -> Preprocessor -> Preprocessor definitions for the Debug configuration. Then I've added
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
to my CMakeLists.txt file, building the Cython code, and that macro has disappeared from the Project properties.
Nevertheless, the project was still requiring python27_d.dll.
I've also added
#define _DEBUG
in one of files, and have got the following compiler warning
C:\projects\project\file.cpp(9): warning C4005: '_DEBUG' : macro redefinition
command-line arguments : see previous definition of '_DEBUG'

LNK 2019:Unresolved External Symbol Error in VS 2010

I am receiving the LNK 2019 error in VS2010 while trying to build the project.I have included the header files from other project using external dependencies.Each time at build time the LNK 2019 rises for the function defined in those header files.Any idea how to fix it?
This error is caused by the linker which cannot find call address of an external function. So it "doesn't know" where is located the implementation of the function declared in your external header file.
To fix this apart from specifying external header files you should also specify the paths to the binary files (".dll" in your case) built from your external project sources. In order to do this use context menu of your project in Visual Studio - {Properties -> Configuration Properties -> Linker -> General}, then add to the "Additional Library Directories" field paths to the directory where your extenal libraries located. After that use {Properties -> Configuration Properties -> Linker -> Input} and add to the "Additional Dependencies" field names of your external libraries ".lib" files.
This should help.

Removing all symbols from EXE file with Visual Studio

I'm linking an executable file with several static libraries (projects in my solution), and want to remove all internal function names from the final .exe file.
Which settings do I have to use for that, and do I have to do that in the library or executable project settings?
Simply building in Release mode doesn't strip the names out of the binary.
Go to Project -> Properties -> Configuration properties -> Linker and in the Debugging section set Generate Debug Info to "No".
Remove them using hex editor, they aren't used inside a code

Resources