Search code examples
c++visual-studiovisual-studio-2010visual-studio-2013lnk2019

LNK2019 : unresolved external symbol, searched for in a non-existing *.obj file


Good morning,
I have just inherited an application from a collegue who has left, and I'm already in trouble: the last thing we have done is porting the solution from Visual Studio 2010 to 2013.
Now while building one of the projects in the solution, I get following error message:
1>usharedmemory.obj : error LNK2019: unresolved external symbol "public: __cdecl C_NamedSemaphore::C_NamedSemaphore(char const *,unsigned int)" (??0C_NamedSemaphore@@QEAA@PEBDI@Z) referenced in function "public: __cdecl C_RecursiveNamedSemaphore::C_RecursiveNamedSemaphore(char const *,unsigned int)" (??0C_RecursiveNamedSemaphore@@QEAA@PEBDI@Z)
This error seems to be caused within the file "Y:\Ucam5\ucm\x\rip_mlfdpf\usharedmemory.obj" (within the project's directory), but after having a quick look, it seems that this *.obj file does not even exist.
Hence the next question: what can I do in order to be sure that the *.obj file gets created? I have already verified that the "usharedmemory.cpp" file is present in the directory of the main project (the corresponding *.h files is located in the "External Dependencies" chapter, which makes me believe that the *.obj file will be created during the build of the main project.
You see my problem: my project refers to a file which the project needs to create, but as the project does not create the file, he obviously can't refer to it, you see the circle I'm running in :-)

(for your information, I have no idea on how to generate an "*.obj" file)

Can anybody help me?
Thanks


Solution

  • Good morning,
    I have finally solved my issue. As a good citizen, I will describe how I have done it :-), but as a less good programmer, I need to admit that I don't understand how my actions solve the problem ;-(
    I have done a file comparison of both *.vcxproj Visual Project files (the old one from VC2010 and the new VC2013 one). In that way I have seen that the "umultiproc.cpp" entry was missing in the VC2013 one:
    <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    ...
    <ItemGroup>
    ...
    <ClCompile Include="..\..\mp\umultiproc.cpp" /> <!-- missing -->

    Summary: In the error message, there was an unresolved symbol (C_Semaphore constructor), which was defined in *.cpp/*.h source/header file. In order to solve the error, I have added a reference to the *.cpp source file into the VC2013 project file.