CS106B Library in Visual Studio 2010 - c++

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!

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.

Issues when compiling the solution file for vtk using CMake

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!

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?

Visual C fatal error LNK1120: 1 unresolved externals

Don't know whats wrong, all help will be greatly appreciated.
I'm thinking I am having a problem with a file source, but am not sure.
1>------ Build started: Project: Assignment 08 ADL, Configuration: Debug Win32 ------
1>Build started 3/18/2013 8:37:38 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Assignment 08 ADL.unsuccessfulbuild".
1>ClCompile:
1> Assignment 08 ADL.cpp
1> Generating Code...
1> Skipping... (no relevant changes detected)
1> student.cpp
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>Assignment 08 ADL.obj : error LNK2019: unresolved external symbol "long __cdecl decimals(class std::basic_ostream<char,struct std::char_traits<char> > &,int)" (? decimals##YAJAAV?$basic_ostream#DU?$char_traits#D#std###std##H#Z) referenced in function "void __cdecl display(class student)" (?display##YAXVstudent###Z)
1>J:\CO 127\Assignment 08 ADL\Debug\Assignment 08 ADL.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:24.82
You need to look at the line above LNK1120, the LNK2019 error tells you what is wrong.
Inside of your void display(class student) function you are calling a function named decimals that is not defined anywhere in your source code or in a library.
This problem appeared to me when I added .c file instead of .cpp
so check the name of the files as well
Make sure the external variable able to access in your current file.
For Testing
easy way is declare same name local variable for testing your logic working not , later change try to access external variable.
LNK 2019 error is a linker error which generally means some object is not available to the linker. Try clean rebuilding the project and then try to execute it.

Build Error "LNK2019: unresolved external symbol _WinMain#16"

So, I am a total noob at C++ and I need serious help. I bet for some average users this is not even a problem, so please help me.
I wrote this in Visual Studio Professional as a Win32 console file.
#include <iostream>
using namespace std;
int main()
{
int i = 100;
return 0;
}
And in the console I get the following:
1>------ Build started: Project: Project1_RenatoAlegre, Configuration: Debug Win32 ------
1>Build started 1/25/2012 3:09:03 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Project1_RenatoAlegre.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function ___tmainCRTStartup
1>c:\users\ren\documents\visual studio 2010\Projects\Project1_RenatoAlegre\Debug\Project1_RenatoAlegre.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:03.37
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have no way of running the program because of this "1 failed" something. I must run the program in Visual Studio Professional.
Project properties -> C/C++ -> Linker -> System -> SubSystem: Console (/SUBSYSTEM:CONSOLE)
If you want a console project.
Please change the subsystem in your linker settings from Windows to Console.
Right click on the Project name in the Solution Explorer
Select Properties
Open Linker in Configuration Properties
Subsystem will be the first item on the list.
Select Console (/SUBSYSTEM:CONSOLE) on the dropdown