I have a c++ Lib project StoreLib, and I have UnitTest Project where I wrote a unit test to test a functionality of class in StoreLib. StoreLibuses bunch of external dlls
My boostTest project compiles and when I run the exe, it complained about missing bunch of dlls, I pasted all of them in my bin folder. Then get this weird error
Store.UnitTests.exe - Entry Point Not Found.
The procedure entry point could not be located in the dynamic link library C:\UnitTest\UnitTests.exe.
First I am unable to understand why is it treating an exe file (UnitTest.exe) as a dynamic link library ? if I write a simple test i.e. Boost_Check(6==6) with out referring to any header file in my StoreLib it works just fine, though moment I refer to any header file from StoreLib it gives above mentioned error.
Any clue what I am doing wrong ? any help would be appreciated
it turned out that the one the external dll included was old, perhaps it was not finding proer entry point
Related
I ported my application from qt 4.8.0 to qt 5.5.1
It compiled without any error but at run time the application crashes and get the message undefined symbol : _Zn9Qwidget11stylechangeER6QStyle in one of my .so file linked dynamically.
When searched couldn't find any function styleChange() in whole project source code.
Cleaned project, deleted all intermediate files, all object files, .so file but same result.
It seemed it is a qt4.8.0 function but could'nt find and hence not able to debug.
Any help would be appreciated.
When searched couldn't find any function styleChange() in whole project source code.
Note that in the mangled name 'c' is in lowercase: stylechange. Have you tried to search for this method?
I've used #jeff_t's solution as presented here however i encountered several issues.
I have a lib that holds a resource file and set as an external file, file name is
Other Files\myfile.exe
A quick look onto the rc file reveals the following line:
IDR_RES RES "Other Files\\myfile.exe"
Now, i set a DLL project which lays at the same directory level as the LIB and includes both resource.h(Read only symbol directives #include "../LIBProj/resource.h") and LIB.rc(Compile time directives #include "../LibProj/LibProj.rc")
Compiling the LIB goes smoothly, however, when i try to compile the DLL, which links against LIB, results the following error:
../LibProj/LibProj.rc(52): error RC2135: file not found: Other Files\myfile.exe
I do understand that once the linker tries to access additional includes from the DLL projects, it goes out off scope, how to i fix it?
Edit: if i give an absolute path as follows:
IDR_GNRC_RES_AGENT_DATA RES "C:\\Develop\\Code\\LibProb\\Other Files\\myfile.exe"
it works well
After many hours of desperate tries, i realized the solution was quite simple.
I had to use the following path:
IDR_FILE RES "..\LIBProj\Other_Files\\MyFile.exe"
So for both projects that would work. LibProj wont be affected, because we go to the parent directory, and then return back. and for the DllProj we go to parent directory which holds both Lib & Dll projects, and then enter Lib's directory.
EDIT:
Updated post to avoid linking to third party sites and to collect all required information here.
Any information is appreciated. If you need more info, please inform me and I will edit the post with the new details.
Here is some useful information to start with.
Errors.
Source code.
I am trying to use a third party SDK consisting of one lib file and essentially one header file. I manage to get the intellisense to work, but I get linker errors even though I have modified my project's build.cs file to add the library path.
public OculusTest(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
// Add static libs
PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "RPLidar/Libraries", "rplidar_driver.lib"));
// Add a path with the .h that has the function definitions
PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "RPLidar", "Includes"));
}
I also checked if I was missing something, but in a standalone C++ project I use the same files and only the same files and it does work. The files in question are
RPLidar.h and rplidar_driver.lib
As such I assume the error is in me failing to tell the Unreal compiler where to find the lib file.
Thank you in advance for all information regarding this way too stubborn error.
I finally found my error.
After checking that the same version of VSC++ was used to compile both programs and that I checked that it was in the correct configuration I changed one extra thing that made it all work out.
Instead of compiling to a multi threaded LIB file, I compiled the code as a DLL file.
I did it by opening the LIB project properties and going to C/C++ -> Code Generation -> Runtime Library and setting it to Multithreaded DLL (/MD).
Under General I set the configuration type to be a static library (.lib).
I have a C++ project where I use Google Test to write my unit tests. The project has been around for a while and is quite messy, so I just added a line at the beginning of the main function that starts the unit tests and then exits the program. I would then comment and uncomment this line for switching between the unit tests and the real application.
This worked okey when only I used my code, but now I'm trying to solve this in a proper way, with two projects and .exe files, one for the real application and one for the tests, like toussa's answer here:
Visual Studio C++: Unit test exe project with google test?
And his explanation for doing so here:
Linking to multiple .obj for unit testing a console application
The problem is that all the .obj-files are put into this library, including the main function. This makes it impossible for me to link with my testmain, as _main is already defined. I tried adding the "/REMOVE" option to the command, so it looks like this:
lib /NOLOGO /OUT:"$(TargetPath).lib" /REMOVE:"$(ProjectDir)$(Configuration)\mainfile.obj" "$(ProjectDir)$(Configuration)\*.obj"
where mainfile.cpp is compiled to mainfile.obj, I hope. The output from lnk is:
LINK : warning LNK4014: cannot find member object C:\dev\solutions\currentSolution\currentProject\Debug\mainfile.obj
The only thing I found about how to write the name of the object file is from here:
http://msdn.microsoft.com/en-us/library/5ff8sk86(v=vs.100).aspx
where they write:
The /REMOVE and /EXTRACT options require the full name of the member object that is to be deleted or copied to a file. The full name includes the path of the original object file. To see the full names of member objects in a library, use DUMPBIN /ARCHIVEMEMBERS or LIB /LIST.
If I type any of those two I get a list where "C:\dev\solutions\currentSolution\currentProject\Debug\mainfile.obj" is one of the entries.
What am I doing wrong? Is there some place that I type something wrong, or is there an easier solution to this problem?
I had exactly the same problem while using Google Test to build unit tests for a console application.
I solved it by splitting the post-build action int two separate lib calls. First one builds the lib from all *.obj files. Second call removes the *.obj file with the main function from the *.lib file.
In your case the calls would be:
lib /NOLOGO /OUT:"$(TargetPath).lib" "$(ProjectDir)$(Configuration)\*.obj"
lib /NOLOGO "$(TargetPath).lib" /REMOVE:"$(ProjectDir)$(Configuration)\mainfile.obj"
can someone please help me to understand the process.
in c++ visual studio 2010
i have a visual studio solution (lets call it mysol)
i have a project built as a static library (let's call it staticprj)
staticprj needs to use a library from outside (lets call it ext.lib)
in the body of the source code of staticprj i include outside library header file with
# include extlib.h and make calls to some of its functions (let call them extfunctions())
i also include the the path to the header files location of the ext.lib.
the staticprj compiles okay without errors
the mysol also has another project which is a dynamic library (dynprj) and which depends on the staticprj.
also in the source files of the dynprj uses functions from outside library.
i have included #include extlib.h in the source code of dynprj.
i have included the path of the header files
i have attached extlib.h directly to the dynprj
i have also added ext.lib to the linker input (along with the path where the ext.lib resides).
i still get a lnk2001 error stating that extfunctions() where not found.
the whole structure (the mysol solution) compiles okay if i do not use ext.lib at all.
my question is how does the linking process works and what can i do to correct this linking error.
(note that without the presence of ext.lib my linking of the staticprj and dynprj is fine. my compilation works okay and my code works. i only get the linking error when i try to link another ext.lib to staticprj and dynprj and use functions from ext.lib)
thanks in advance.
I'm not quite sure it will work, but try putting the .dll inside your "mysol" debug folder. I had a similar problem couple of weeks ago when I had library compiled as .dll. I just placed that .dll within my debug folder and worked lovely.