Issues when compiling the solution file for vtk using CMake - c++

Like I said, I'm trying to compile VTK (version 5.10.1) using CMake (2.8.12) and QT (4.7.4)
After following the instructions for installing QT using visual studios cmd line, I open up vtk's source, run CMAKE, and attempt to compile the solution file using Visual Studio Pro.
There's a few libraries that aren't compiling, but I'm hoping if someone can explain how to fix one, I can try and fix the others on my own.
When building QVTKWidgetPlugin, I keep getting the following error codes:
1>------ Build started: Project: ZERO_CHECK, Configuration: Release Win32 ------
1>Build started 8/10/2015 9:57:50 PM.
1>InitializeBuildStatus:
1> Creating "Win32\Release\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>FinalizeBuildStatus:
1> Deleting file "Win32\Release\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild".
1> Touching "Win32\Release\ZERO_CHECK\ZERO_CHECK.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.10
2>------ Build started: Project: QVTKWidgetPlugin, Configuration: Release Win32 ------
2>Build started 8/10/2015 9:57:51 PM.
2>InitializeBuildStatus:
2> Touching "QVTKWidgetPlugin.dir\Release\QVTKWidgetPlugin.unsuccessfulbuild".
2>CustomBuild:
2> All outputs are up-to-date.
2>ClCompile:
2> All outputs are up-to-date.
2>Link:
2> Creating library C:/vtk/bin/bin/Release/QVTKWidgetPlugin.lib and object C:/vtk/bin/bin/Release/QVTKWidgetPlugin.exp
2>Q4VTKWidgetPlugin.obj : error LNK2019: unresolved external symbol "private: static struct QString::Data QString::shared_null" (?shared_null#QString##0UData#1#A) referenced in function "public: __thiscall QString::QString(void)" (??0QString##QAE#XZ)
2>Q4VTKWidgetPlugin.obj : error LNK2019: unresolved external symbol "public: static struct QListData::Data QListData::shared_null" (?shared_null#QListData##2UData#1#A) referenced in function "public: __thiscall QList<class QDesignerCustomWidgetInterface *>::QList<class QDesignerCustomWidgetInterface *>(void)" (??0?$QList#PAVQDesignerCustomWidgetInterface####QAE#XZ)
2>moc_Q4VTKWidgetPlugin.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QWidget::staticMetaObject" (?staticMetaObject#QWidget##2UQMetaObject##B)
2>moc_Q4VTKWidgetPlugin.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QObject::staticMetaObject" (?staticMetaObject#QObject##2UQMetaObject##B)
2>C:\vtk\bin\bin\Release\QVTKWidgetPlugin.dll : fatal error LNK1120: 4 unresolved externals
2>
2>Build FAILED.
2>
2>Time Elapsed 00:00:00.14
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I understand that its basically looking for things that aren't defined, but I'm not sure how to fix it. As far as I know this should all run 100% from QT->VTK but I'm having some issues. Thanks in advance!

Related

How to solve 'error LNK2001: unresolved external symbol' for writing a User-defined Model (FLAC) in Visual Studio 2010 C++?

I am trying to write a User-defined Model in C++ for FLAC in Visual Studio Express 2010 C++. Initially, I am trying to run (debug and build) the built-in Strain-softening Model based on the Mohr-Coulomb criterion (Available in FLAC 8.0) by changing its name only. Once I succeed to do it, I will try to modify it as per my requirement. I am running the code in VS2010. I have already installed SDK7.1, VS2010 SP1, etc. However, I am getting the following error msg:
1>------ Build started: Project: i_ssoft, Configuration: Debug x64 ------
1> modeli_ssoft.cpp
1> Creating library C:\Program Files\Itasca\FLAC800\PluginFiles\Models\modeli_ssoft\i_ssoft\i_ssoft.lib and object C:\Program Files\Itasca\FLAC800\PluginFiles\Models\modeli_ssoft\i_ssoft\i_ssoft.exp
1>modeli_ssoft.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl models::ConstitutiveModel::getPluginName(void)const " (?getPluginName#ConstitutiveModel#models##UEBA?AV?$basic_string#_WU?$char_traits#_W#std##V?$allocator#_W#2##std##XZ)
1>C:\Program Files\Itasca\FLAC800\PluginFiles\Models\modeli_ssoft\i_ssoft\\i_ssoft.dll : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
From the error code, it is clear that I need to add some libraries or I need to place the supporting libraries in the same project directory... which I have tried but still, I am getting the error.

LNK2019 error when using a library installed with vcpkg

I have installed libraries with vcpkg using the correct triplet :
C:\Users\***>vcpkg list libnoise
libnoise:x64-windows 1.0.0 A general-purpose library that generates three-d...
Then I have executed the following command :
C:\Users\***>vcpkg integrate install
Applied user-wide integration for this vcpkg root.
All MSBuild C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=C:/Windows/vcpkg/scripts/buildsystems/vcpkg.cmake"
But in my Visual Studio 2019 project, with an x64 project, only the headers have been successfully integrated :
#include <noise/noise.h> // The header is found as well as the definition of noise::module::Perlin
int main()
{
noise::module::Perlin noise; // The implementation is not found
}
When trying to compile this, I get :
1>------ Build started: Project: Mayak, Configuration: Debug x64 ------
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl noise::module::Perlin::Perlin(void)" (__imp_??0Perlin#module#noise##QEAA#XZ) referenced in function main
1>NoiseVideoGenerator.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl noise::module::Perlin::Perlin(void)" (__imp_??0Perlin#module#noise##QEAA#XZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl noise::module::Perlin::~Perlin(void)" (__imp_??1Perlin#module#noise##UEAA#XZ) referenced in function main
1>NoiseVideoGenerator.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl noise::module::Perlin::~Perlin(void)" (__imp_??1Perlin#module#noise##UEAA#XZ)
1>C:\Users\sylva\source\repos\Mayak\x64\Debug\Mayak.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "Mayak.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
On a side note, I have looked for the name of the .lib files of the noise library and tried to add them in the Linker > Input properties, it still doesn't work.
What did I do wrong ?
To enable AutoLink, select your current project and go to properties. (Alt-Enter) Make sure you edit the right configuration. Then go to Configuration Properties -> vcpkg and make sure AutoLink is enabled.
It has been fixed by the developers, on GitHub : https://github.com/microsoft/vcpkg/issues/14127

Unresolved External Symbol __imp__Py_Finalize

I literally just got Python.h to link to my Visual Studio 2017 IDE and then when I ran it, it spat this error out for me.
I use VS2017, and I am learning C++, so I have no idea why this is happening. I linked my Python.h file's directory in the project properties.
Full Build Logs:
1>------ Build started: Project: PyC++, Configuration: Release Win32 ------
1>PyC++.obj : error LNK2001: unresolved external symbol __imp__Py_Finalize
1>PyC++.obj : error LNK2001: unresolved external symbol __imp__Py_SetProgramName
1>PyC++.obj : error LNK2001: unresolved external symbol __imp__Py_InitializeEx
1>C:\Users\maste\source\repos\PyC++\Release\PyC++.exe : fatal error LNK1120: 3 unresolved externals
1>Done building project "PyC++.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Try to include pythonxx.lib(such as python26.lib) in your references.
The answer is simple, like #Xiaoying Sun has stated, put the python38.lib file in your references, however, you're required to put it in your VC++ directories, this way it will work.

CS106B Library in Visual Studio 2010

I feel like this question should have been asked already but I haven't been able to find any solutions to accomplish this. But basically I'm going through the youtube lecture videos for Stanford's CS106B course on C++ and I'd like to use their libraries in my Visual Studio 2010, but i'm a VS newbie so I'm not sure how to get the include to work. I've tried to include the path to Project|Options|Include Directories but I get the following error
1>------ Build started: Project: HelloWorld, Configuration: Debug Win32 ------
1>Build started 1/26/2015 8:28:05 PM.
1>InitializeBuildStatus:
1> Touching "Debug\HelloWorld.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>HelloWorld.obj : error LNK2019: unresolved external symbol "int __cdecl getInteger(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?getInteger##YAHABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##0#Z) referenced in function _main
1>C:\CppProjects\HelloWorld\Debug\HelloWorld.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.88
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Update: I downloaded the library from here: http://stanford.edu/~stepp/cppdoc/
And i'm using the Visual Studio IDE.
Any assistance would be awesome, and then I'd know how to include external libraries!

gmp.h /mpir.h linker in visual studio 2012 professional

I am trying to use gmp.h for C/C++. I am currently working on visual studio 2012 professional. I followed the instructions from the link. But still I got error messages...
1>------ Build started: Project: final, Configuration: Debug Win32 ------
1> final.cpp
1>final.obj : error LNK2019: unresolved external symbol ___gmpz_init referenced in function _wmain
1>final.obj : error LNK2019: unresolved external symbol ___gmpz_init_set_ui referenced in function _wmain
1>final.obj : error LNK2019: unresolved external symbol ___gmpz_out_str referenced in function _wmain
1>D:\New folder\final\Debug\final.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I tried all possible options but could not got the solution. Please help me out
I had the same problem and it was just that I wasn't linking the library.
You need to include the library in the Visual Studio project.
How to add additional libraries to Visual Studio project?