# error LNK2019: unresolved external symbol _WSInitialize

I tried to run very simple example of connecting to WSTP. I checked a few links in this site but none of them could resolved my issue. I added three .lib files to visual studio location from this link and also linked to my program on visual studio. Also i did it for wstp.h and .exe. each one as explained in documentation developer tutorial. I modified the linker on C++ project and added all these files to current project on visual studio. But still i am getting this problem. I wish they had better documentation. Can someone help me , thanks
error LNK2019: unresolved external symbol _WSInitialize
error LNK2019: unresolved external symbol _WSDeinitialize
error LNK2019: unresolved external symbol _WSOpenString
error LNK2019: unresolved external symbol _WSClose

#include "wstp.h"
#include<iostream>
using namespace std;
int main()
{
WSENV env;
int error;

env = WSInitialize((WSEnvironmentParameter)0);
if (env == (WSENV)0)
{ /* unable to initialize WSTP environment */
}

{ /* unable to create link to the Kernel */
}

/* ... */

WSDeinitialize(env);

return 0;
}


EDITED Solved: beside the right answer, i should have compile as x64 because my system is 64bit, but i ran the program as x86 and got those errors

Those particular linker errors mean that the input library was not added under the linker settings. I put together an example project on GitHub that you can use for reference. The paths are currently setup for the default installation location for Mathematica 12.2.

• that really helped me, one more mistake which i did, I compiled the code as x86 but my system is 64 bits, so i had to change it to x64. thanks – Azzurro94 Mar 3 at 14:50
• could you tell me what should be instead of -mathlink? is that mathlink.exe? thanks – Azzurro94 Mar 3 at 15:06
• In newer versions, -wstp is preferred. But -mathlink still exists for compatibility reasons. – ihojnicki Mar 3 at 19:26