I am new to C++ and trying to learn from online Stanford CS106B course.
In this course, people from Stanford have provided external C++ libraries (Link to which is given below).
I have downloaded this zip file and extracted the contents. The folder structure looks like this
D:.
├───doc
│ ├───HelloWorld2
│ ├───images
│ └───pictures
│ ├───ClassHierarchies
│ ├───GInteractorDiagrams
│ ├───GObjectDiagrams
│ └───HelloWorld
├───examples
│ ├───DrawDiagonals
│ ├───DrawLines
│ ├───DrawRectangles
│ ├───Flower
│ ├───GHelloWorld
│ ├───GraphicsExample
│ ├───HelloWorld
│ ├───PacMan
│ ├───Snowflake
│ ├───Stoplight
│ └───USFlag
│ └───images
├───include
│ └───private
├───java
│ ├───classes
│ ├───java
│ └───src
│ └───edu
│ └───stanford
│ └───cs
│ └───java
│ ├───graphics
│ ├───spl
│ └───tokenscanner
├───lib
├───obj
└───src
└───tests
The include folder contains all the header file for the classes and functions and lib folder contains *.lib file used for static import of external library.
I tried importing external library in Visual Studio 2022 project by writing a dummy program shown below.
#include<iostream>
#include<string>
#include"simpio.h"
int main()
{
int limit = getInteger("Enter exponent limit: ");
std::cout << "Library import worked" << std::endl;
return 0;
}
To include the external libraries, I followed the steps in the tutorial, who's link is given below.
https://www.youtube.com/watch?app=desktop&v=ZYLKI8FxiD8
The settings for included files in my projects are shown in the pictures below
and
Even after doing all of this, when I build my project, I am getting following errors
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "int __cdecl getInteger(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?getInteger@@YAHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function main Project1 D:\to copy\C++\CS106B\trial_chapter\Project1\main.obj 1
Warning LNK4272 library machine type 'x86' conflicts with target machine type 'x64' Project1 D:\to copy\C++\CS106B\cpplib\cpplib\lib\StanfordCPPLib.lib 1
Error LNK1120 1 unresolved externals Project1 D:\to copy\C++\CS106B\trial_chapter\Project1\x64\Debug\Project1.exe 1
I tried reading solutions from existing stack overflow questions but that did not help as I do not understand what am I doing wrong.
Can someone please help me with this..
Stanford C++ Library link https://cs.stanford.edu/people/eroberts/StanfordCPPLib/


