3dtof / voxelsdk

VoxelSDK - an SDK supporting TI's 3D Time of Flight cameras
BSD 3-Clause "New" or "Revised" License
108 stars 71 forks source link

Windows 8.1 : Compile errors from Qt 5.4 #3

Closed Yorkland closed 9 years ago

Yorkland commented 9 years ago

(VS 2013 community + qt-vs-addin-1.2.3 + Qt 5.4.2) I try to involve the sample code (SimpleVoxelViewer.cpp) into my new create Qt project. I got compile errors while the code involves “PCLViewer” or “CLIManager”, (1) Voxel::PCLViewer v;, or, (2) Voxel::CLIManager manager(sys);

error LNK2019: unresolved external symbol "public: void cdecl Voxel::PCLViewer::stop(void)" (?stop@PCLViewer@Voxel@@QEAAXXZ) referenced in function "public: virtual cdecl Voxel::PCLViewer::~PCLViewer(void)" (??1PCLViewer@Voxel@@UEAA@XZ)

errormessage

The error message, it looks like I lack some specific lib file(s). But I have involved the following lib(s) in the project setting, What LIB(s) else I need to link? Or that message caused by the other problems?

lib_list

hlprasu commented 9 years ago
  1. Could you please send all the 4 error messages shown by the linker?
  2. Are you using the installed version of Voxel SDK or built it from source?
  3. Please share the steps taken to create the Qt project.

On 4 June 2015 at 17:19, York Wu notifications@github.com wrote:

(VS 2013 community + qt-vs-addin-1.2.3 + Qt 5.4.2) I try to involve the sample code (SimpleVoxelViewer.cpp) into my new create Qt project. I got compile errors while the code involves “PCLViewer” or “CLIManager”, (1) Voxel::PCLViewer v;, or, (2) Voxel::CLIManager manager(sys);

error LNK2019: unresolved external symbol "public: void cdecl Voxel::PCLViewer::stop(void)" (?stop@PCLViewer@Voxel@@QEAAXXZ) referenced in function "public: virtual cdecl Voxel::PCLViewer::~PCLViewer(void)" (??1PCLViewer@Voxel@@UEAA@XZ)

[image: errormessage] https://cloud.githubusercontent.com/assets/10955526/7983310/9a25362c-0af1-11e5-9edd-b32bd13e4fda.jpg

The error message, it looks like I lack some specific lib file(s). But I have involved the following lib(s) in the project setting, What LIB(s) else I need to link? Or that message caused by the other problems?

[image: lib_list] https://cloud.githubusercontent.com/assets/10955526/7983386/4de84afa-0af2-11e5-8c0a-24c6f47e0ce6.jpg

— Reply to this email directly or view it on GitHub https://github.com/3dtof/voxelsdk/issues/3.

~ Prasad Bhat

Yorkland commented 9 years ago

I use the installed version of Voxel SDK.

// TI's sample code void VoxelSDKTestByQt1::onActionSimpleVoxelViewer() { Voxel::PCLViewer v; // If disable this line, the errors will disappear. // v.setDepthCamera(depthCamera); // v.start(); // while (v.isRunning()) // std::this_thread::sleep_for(std::chrono::milliseconds(1000)); }

If I enable the line "Voxel::PCLViewer v;", the 4 errors are,

[Error 3] error LNK2019: unresolved external symbol "public: void cdecl Voxel::PCLViewer::stop(void)" (?stop@PCLViewer@Voxel@@QEAAXXZ) referenced in function "public: virtual cdecl Voxel::PCLViewer::~PCLViewer(void)" (??1PCLViewer@Voxel@@UEAA@XZ) [Error 2] error LNK2019: unresolved external symbol "public: bool __cdecl Voxel::PCLViewer::isRunning(void)" (?isRunning@PCLViewer@Voxel@@QEAA_NXZ) referenced in function "public: virtual cdecl Voxel::PCLViewer::~PCLViewer(void)" (??1PCLViewer@Voxel@@UEAA@XZ) [Error 1] error LNK2019: unresolved external symbol "public: cdecl Voxel::PCLViewer::PCLViewer(void)" (??0PCLViewer@Voxel@@QEAA@XZ) referenced in function "protected: void __cdecl VoxelSDKTestByQt1::onActionSimpleVoxelViewer(void)" (?onActionSimpleVoxelViewer@VoxelSDKTestByQt1@@IEAAXXZ) [Error 4] error LNK1120: 3 unresolved externals

Yorkland commented 9 years ago

// TI's sample code void VoxelSDKTestByQt1::onActionVoxelCLIManager() { Voxel::logger.setDefaultLogLevel(Voxel::LOG_INFO); Voxel::CameraSystem sys; Voxel::CLIManager manager(sys); // If remark this line, error will disapear. // manager.run(); }

While enable the code "Voxel::CLIManager manager(sys); ", I got 2 errors.

[Error 1] error LNK2019: unresolved external symbol "public: cdecl Voxel::CLIManager::CLIManager(class Voxel::CameraSystem &)" (??0CLIManager@Voxel@@QEAA@AEAVCameraSystem@1@@Z) referenced in function "protected: void cdecl VoxelSDKTestByQt1::onActionVoxelCLIManager(void)" (?onActionVoxelCLIManager@VoxelSDKTestByQt1@@IEAAXXZ) [Error 2] error LNK1120: 1 unresolved externals

hlprasu commented 9 years ago

Ok. Now I understand.

PCLViewer and CLIManager are not exported classes and used in the app layer alone with no library to link to.

I would recommend you to begin with cpp files from voxel-sdk/Test. Primarily, the CameraSystemTest.cpp to use the SDK layer.

If you need the PCLViewer or CLIManager explicitly for your application, please include PCLViewer.cpp and CLIManager.cpp into your project.

On 4 June 2015 at 17:51, York Wu notifications@github.com wrote:

// TI's sample code void VoxelSDKTestByQt1::onActionVoxelCLIManager() { Voxel::logger.setDefaultLogLevel(Voxel::LOG_INFO); Voxel::CameraSystem sys; Voxel::CLIManager manager(sys); // If remark this line, error will disapear. // manager.run(); }

While enable the code "Voxel::CLIManager manager(sys); ", I got 2 errors.

[Error 1] error LNK2019: unresolved external symbol "public: cdecl Voxel::CLIManager::CLIManager(class Voxel::CameraSystem &)" (??0CLIManager@Voxel@@QEAA@AEAVCameraSystem@1@@Z https://github.com/Z) referenced in function "protected: void cdecl VoxelSDKTestByQt1::onActionVoxelCLIManager(void)" (?onActionVoxelCLIManager@VoxelSDKTestByQt1@@IEAAXXZ) [Error 2] error LNK1120: 1 unresolved externals

— Reply to this email directly or view it on GitHub https://github.com/3dtof/voxelsdk/issues/3#issuecomment-108869318.

~ Prasad Bhat

hlprasu commented 9 years ago

If you want CLIManager in particular, please include LineNoise.cpp and LineNoiseUTF8.cpp as well into your project.

On 4 June 2015 at 17:57, Prasad Bhat hlprasu@gmail.com wrote:

Ok. Now I understand.

PCLViewer and CLIManager are not exported classes and used in the app layer alone with no library to link to.

I would recommend you to begin with cpp files from voxel-sdk/Test. Primarily, the CameraSystemTest.cpp to use the SDK layer.

If you need the PCLViewer or CLIManager explicitly for your application, please include PCLViewer.cpp and CLIManager.cpp into your project.

On 4 June 2015 at 17:51, York Wu notifications@github.com wrote:

// TI's sample code void VoxelSDKTestByQt1::onActionVoxelCLIManager() { Voxel::logger.setDefaultLogLevel(Voxel::LOG_INFO); Voxel::CameraSystem sys; Voxel::CLIManager manager(sys); // If remark this line, error will disapear. // manager.run(); }

While enable the code "Voxel::CLIManager manager(sys); ", I got 2 errors.

[Error 1] error LNK2019: unresolved external symbol "public: cdecl Voxel::CLIManager::CLIManager(class Voxel::CameraSystem &)" (??0CLIManager@Voxel@@QEAA@AEAVCameraSystem@1@@Z https://github.com/Z) referenced in function "protected: void cdecl VoxelSDKTestByQt1::onActionVoxelCLIManager(void)" (?onActionVoxelCLIManager@VoxelSDKTestByQt1@@IEAAXXZ) [Error 2] error LNK1120: 1 unresolved externals

— Reply to this email directly or view it on GitHub https://github.com/3dtof/voxelsdk/issues/3#issuecomment-108869318.

~ Prasad Bhat

~ Prasad Bhat

Yorkland commented 9 years ago

Yes, it's workable. I involve PCLViewer(h,cpp), CLIManager(h,cpp) in the project. Thanks a lot.

Yorkland commented 9 years ago

After involve PCLViewer.h/cpp & CLIManager.h/cpp, I got the new 53 compile errors in "PCLViewer.obj" and "CLIManager.obj".

error_in_pclviewer_obj

I list the fist 2 errors, [Error 8] - file: PCLViewer.obj error LNK2019: unresolved external symbol "void cdecl pcl::console::print(enum pcl::console::VERBOSITY_LEVEL,char const *,...)" (?print@console@pcl@@YAXW4VERBOSITY_LEVEL@12@PEBDZZ) referenced in function "public: bool cdecl pcl::visualization::PCLVisualizer::addPointCloud(class boost::shared_ptr<class pcl::PointCloud const > const &,class pcl::visualization::PointCloudColorHandler const &,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,int)" (??$addPointCloud@UPointXYZI@pcl@@@PCLVisualizer@visualization@pcl@@QEAA_NAEBV?$shared_ptr@$$CBV?$PointCloud@UPointXYZI@pcl@@@pcl@@@boost@@AEBV?$PointCloudColorHandler@UPointXYZI@pcl@@@12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)

[Error 2] - file: CLIManager.obj error LNK2019: unresolved external symbol "void cdecl LineNoise::linenoiseAddCompletion(struct LineNoise::linenoiseCompletions ,char const )" (?linenoiseAddCompletion@LineNoise@@YAXPEAUlinenoiseCompletions@1@PEBD@Z) referenced in function "protected: void cdecl Voxel::CLIManager::_completionCallback(char const ,struct LineNoise::linenoiseCompletions )" (?_completionCallback@CLIManager@Voxel@@IEAAXPEBDPEAUlinenoiseCompletions@LineNoise@@@Z)

Yorkland commented 9 years ago

Sorry, miss your indications, I am trying to involve "LineNoise.cpp" & "LineNoiseUTF8.cpp".

hlprasu commented 9 years ago

As mentioned in a previous message -

If you want CLIManager in particular, please include LineNoise.cpp and LineNoiseUTF8.cpp as well into your project.

On 4 June 2015 at 18:24, York Wu notifications@github.com wrote:

After involve PCLViewer.h/cpp & CLIManager.h/cpp, I got the new 53 compile errors in "PCLViewer.obj" and "CLIManager.obj".

[image: error_in_pclviewer_obj] https://cloud.githubusercontent.com/assets/10955526/7984278/8dafb396-0afa-11e5-92e1-71b2539eb4ef.jpg

I list the fist 2 errors, [Error 8] - file: PCLViewer.obj error LNK2019: unresolved external symbol "void cdecl pcl::console::print(enum pcl::console::VERBOSITY_LEVEL,char const *,...)" (?print@console@pcl@@YAXW4VERBOSITY_LEVEL@12@PEBDZZ) referenced in function "public: bool cdecl pcl::visualization::PCLVisualizer::addPointCloud(class boost::shared_ptr const > const &,class pcl::visualization::PointCloudColorHandler const &,class std::basic_string,class std::allocator > const &,int)" (??$addPointCloud@UPointXYZI@pcl@@@PCLVisualizer@visualization@pcl@ @QEAA_NAEBV?$shared_ptr@$$CBV?$PointCloud@UPointXYZI@pcl@@@pcl https://github.com/pcl@@@boost https://github.com/boost @@AEBV?$PointCloudColorHandler@UPointXYZI@pcl@@@12 https://github.com/12 @AEBV?$basic_string@DU?$char_traits@D@std@@V https://github.com/V ?$allocator@D@2@@std< /a>@ https://github.com/std@H@Z)

[Error 2] - file: CLIManager.obj error LNK2019: unresolved external symbol "void cdecl LineNoise::linenoiseAddCompletion(struct LineNoise::linenoiseCompletions ,char const )" (?linenoiseAddCompletion@LineNoise @@YAXPEAUlinenoiseCompletions@1@PEBD@Z) referenced in function "protected: void cdecl Voxel::CLIManager::_completionCallback(char const ,struct LineNoise::linenoiseCompletions )" (?_completionCallback@CLIManager@Voxel@ @IEAAXPEBDPEAUlinenoiseCompletions@LineNoise@@@Z https://github.com/Z)

— Reply to this email directly or view it on GitHub https://github.com/3dtof/voxelsdk/issues/3#issuecomment-108884081.

~ Prasad Bhat

hlprasu commented 9 years ago

Ok, apart from that you'll have to link to PCL and VTK libraries located in PCL install directory.

Linking to necessary PCL and VTK libraries manually might be cumbersome. If you are using CMake for your build system, then have a look at voxel-sdk/App/CMakeLists.txt

On 4 June 2015 at 18:31, York Wu notifications@github.com wrote:

Sorry, miss your indications, I am trying to involve "LineNoise.cpp" & "LineNoiseUTF8.cpp".

— Reply to this email directly or view it on GitHub https://github.com/3dtof/voxelsdk/issues/3#issuecomment-108889209.

~ Prasad Bhat

Yorkland commented 9 years ago

An error in "LineNoise.cpp", how to fix the type?

error_in_linenoise

[Error 2] IntelliSense: argument of type "const char " is incompatible with parameter of type "LPCWSTR" [Error 1] error C2664: 'BOOL WriteConsoleOutputCharacterW(HANDLE,LPCWSTR,DWORD,COORD,LPDWORD)' : cannot convert argument 2 from 'const char ' to 'LPCWSTR'

Yorkland commented 9 years ago

I force to change the type by "LPCWSTR()" to solve it temporarily. WriteConsoleOutputCharacter(current->outh, LPCWSTR(buf), len, pos, &n);

There are still 46 LNK2019 errors in "PCLViewer.obj", I think they caused by PCL and VTK libraries, I will try to check the info from CMakeList.txt tomorrow. Thanks for your help anyway.

hlprasu commented 9 years ago

Looks like UNICODE is enabled by default in your code.

Because of this windows API WriteConsoleOutputCharacter(), the second argument type has been changed from LPCTSTR (see https://msdn.microsoft.com/en-us/library/windows/desktop/ms687410%28v=vs.85%29.aspx) to LPCWSTR causing the compiler error.

On 4 June 2015 at 18:55, York Wu notifications@github.com wrote:

I force to change the type by "LPCWSTR()" to solve it temporarily. WriteConsoleOutputCharacter(current->outh, LPCWSTR(buf), len, pos, &n);

There are still 46 LNK2019 errors in "PCLViewer.obj", I think they caused by PCL and VTK libraries, I will try to check the info from CMakeList.txt tomorrow. Thanks for your help anyway.

— Reply to this email directly or view it on GitHub https://github.com/3dtof/voxelsdk/issues/3#issuecomment-108898015.

~ Prasad Bhat