We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Link Error - error LNK2019: unresolved external symbol - C/C++

F-J-K asked
Medium Priority
Last Modified: 2012-05-06
remoteSide.cpp includes header called "ConnectToClient.h".

ConnectToClient resides in a header files folder for a different project. Therefore my remoteSide.cpp includes the header as follows:

#include "C:\Users\Admin\Desktop\X-Shab\X-Shab\ConnectToClient.h"

I still get linking error, whether i include the absolute path or not. What can i do? AFAIK, it got to do with additional dependencies or so. Can you explain well - if you don't mind.

1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>remoteSide.obj : error LNK2019: unresolved external symbol "public: __thiscall ConnectToClient::~ConnectToClient(void)" (??1ConnectToClient@@QAE@XZ) referenced in function _main
1>remoteSide.obj : error LNK2019: unresolved external symbol "public: __thiscall ConnectToClient::ConnectToClient(char const *,char const *)" (??0ConnectToClient@@QAE@PBD0@Z) referenced in function _main
1>C:\Users\Admin\Desktop\X-Shab\Debug\RemoteSide.exe : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://c:\Users\Admin\Desktop\X-Shab\RemoteSide\Debug\BuildLog.htm"
1>RemoteSide - 3 error(s), 0 warning(s)

Open in new window

Watch Question

Top Expert 2007

The other project should contain a ConnectToClient.lib, or a library of another name that includes ConnectToClient.

Add that library to the list of libraries included in the project.  If you need instructions on how to do that, please say what version of Visual Studio you're using.


The other project has ConnectToClient.h in the Header Files folder & ConnectToClient.cpp in Source Files folder - i did not put ConnectToClient in any library, nor i made it standard.

If you can give the instructions, i will appreciate it. I'm using Visual Studio 2008
Top Expert 2007

I guess I need to clarify...

1)  Are you including ConnectToClient.cpp in your project?
2)  If not, what does the other project create -- an .exe? a dll? a lib?
3)  Does ConnectToClient define two constructors -- one taking no arguments and the other taking two char const *?


1. no
2. .exe
3. yes
Top Expert 2007

If the other project created a .lib, then we could use that .lib and statically link it in.  However, it is creating an exe, so that's out.

I see two choices:
1)  Use CreateProcess (for example) to spawn another process that runs ConnectToClient.exe, passing the necessary command line arguments.  This assumes that ConnectToClient accepts command line arguments.
2)  Include ConnectToClient.cpp in your project, along with any headers and cpp files that it needs in order to build.

If you pick the second, then you'll have to include any inclusion paths and linkage paths the ConnectToClient project uses.  This isn't difficult, just a bit of a pain.

I suggest the second approach, unless it starts to balloon in effort -- needing to include all sorts of other cpp files and headers and the like.


1. Yes including it in the header such as #include "C:\Users\Admin\Desktop\X-Shab\X-Shab\ConnectToClient.h", but not including the file the .h & .cpp into my remoteSide project.


no sorry, ConnectToClient.cpp does not have main(). It does not produce ConnectToClient.exe
Top Expert 2007

If you open the other project, open the solution window, right-click the solution, click properties, and look in the application tab, you'll see "Output type".  That should be Windows application, console application, or class library.

If it is class library, then the project emits a .lib that we can use.


can you tell me how to make my headers as standard in VS 2008, not VC++.
Top Expert 2007
To define a folder containing headers for a project,
1)  Right-click the project in solution explorer
2)  Select properties
3)  Select Configuration Properties | C/C++ | General
4)  The top line in the right-hand pane is "Additional Include Directories" and contains all additional folders in which VS 2008 will look for headers.  If you click on "Additional Include Directories", a 3-dot (ellipsis) button will appear.  Click that button and a popup window will open that lets you add directories.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Ok, i did it. I went to this folder ""C:\Users\Admin\Desktop\X-Shab\X-Shab" which contains all .h & its .cpp
such as ConnectToClient.h, ConnectToClient.cpp, MainMenus.h, MainMenus.cpp,etc. When i get into the folder, the file browser does not show any of file inside the folder X-Shab. Thus, this path "C:\Users\Admin\Desktop\X-Shab\X-Shab" does not help when its added into is "Additional Include Directories". Anyhow, i added it there & change mt include format from #include "ConnectToClient.h" to #include <ConnectToClient.h>. I get this error  fatal error C1083: Cannot open include file: 'ConnectToClient.h': No such file or directory

Top Expert 2007
>>the file browser does not show any of file inside the folder X-Shab.  Thus this path...does not help
The path C:\Users\Admin\Desktop\X-Shab makes me think there are multiple users for this PC, and that X-Shab is another user who is keeping these files on his desktop.  (I'm not sure of myself here, but at least this theory fits the observed facts).  If I'm right, then you'll need to ask X-Shab for a copy of these files and then place them in a folder that is accessible to you.

Then you should be able to update the include path to point to the new folder rather than X-Shab's folder.

I hope this helps.  It's time for me to go sleep.  I'll be happy to help some more tomorrow.

If my guess on the X-Shab path is wrong, please let me know.



This helped. I will check out & i hope it works. Thanks


Thank you
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.