1

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

1
  • 1
    Maybe the project dependencies are ordered wrong. The project which is looking for the .obj file is being built before the project which will generate the .obj file. Hence, the error. Commented Sep 16, 2015 at 10:02

2 Answers 2

3

Object files (*.obj) are created directly from source files (*.cpp) by the compiler at compilation time, for each source file in your project.

The error you are receiving is not caused by usharedmemory.obj not existing; it should be created in the Debug or Release folders.

The error you are getting is because usharedmemory.cpp uses the C_NamedSemaphore(char const *,unsigned int)-constructor of C_NamedSemaphore and the definition of the constructor can not be found in any of the source files. This constructor is used in the C_RecursiveNamedSemaphore(char const *,unsigned int)-constructor defined in usharedmemory.cpp. This is what the error message reads.

To solve this, you need to find out where the constructor of C_NamedSemaphore is defined (which source file) and ensure that this source file is included in your project. Or, if it is in a library file (static or dynamic), verify that this library file is included as an Additional Dependency (under project Properties -> Linker -> Input -> Additional Dependencies; ensure you set this for all builds, not just the currently active one).

Sign up to request clarification or add additional context in comments.

Comments

-1

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.