My client provide me a dll file without any lib file for the project, so I create a lib file from this link.
Now after successfully generating a lib file I follow the answer of this link
Now after following these two links, I simply build my code in which I have not define any thing till now.My code build successfully, but when I build my code after calling a function from my lib file I got this:-
error C3861: 'upgStop': identifier not found
where upgStop is the function that I call.
It seems something went wrong while linking the lib file. So, guys please tell the exact solution of this problem.
'Identifier not found' is a compiler error (not linker error) which implies the header file which specifies upgStop() hasn't been #included in the file from which the function is being called.
Do you have a header file which contains the declaration/prototype of ugpStop()?
Once this is resolved, you may have linker errors isntead - as you either need to link against the dll/lib, or load it dynamically using "LoadLibrary()" (and then find functions within the loaded library by their string name.
Related
The debug point is not getting enabled when this module gets loaded. So I thought of manually loading its debug symbols .pdb file from "Debug/obj" folder.
In this case I am getting below error "A matching symbol" file was not found in this folder though that folder contains currently build file.
And also the "Symbol Load Information" contains these many directory paths.
Cannot find or open the PDB file.
PDB does not match
Screenshot:
This problem is fixed by the following steps-
1) Close all the instances of VISUAL STUDIO if running and open a single instance of Visual Studio
2) Close the solution (nothing but your project) If it's already open and then re-open again
3) Clean the whole project and rebuild it.
4) and also build the project if you are getting any errors like "___.dll not found"
5) Now you are good to go and run your project
After breaking my head on this, for me it happened when I configured my project to seperate binaries from objects that way:
For Output directory:
$(SolutionDir)build\bin\$(PlatformTarget)-$(Configuration)\
For Intermediate Directory:
$(SolutionDir)build\obj\$(PlatformTarget)-$(Configuration)\$(ProjectName)\
Even though the I still had the generated .pdb where my exe or trying to even load it manually, it didn't work.
So I went again to Configuration Properties -> Linker -> Debugging and where the property Generate Program Database File I changed from $(OutDir)$(TargetName).pdb to $(IntDir)$(TargetName).pdb so it will throw the desired database file into the place where the objects(Intermediate Directory) are instead of where the .exe(Output directory). Hopefully that helped someone :)
I have finished a project developed in Visual Studio 2013 (Windows) using OpenCV. Now, my manager told me he needs the code files and the CMAKE file.
I'm reading this documents:
https://cognitivewaves.wordpress.com/cmake-and-visual-studio/
http://www.cmake.org/cmake-tutorial/
but I don't understand properly and I don't know if they are what I need...
I can explain a little bit more my project:
My project has:
main.cpp
Some .cpp created by myshelf.
Some .h created by myshelf.
I use OpenCV libraries (lib, dll, ...)
I use Vimba libraries (lib, dll, ...).
I have never worked with CMAKE files... Could anyone lead me about how create this file/s?? I'm really missed...
THANKS in advance!!!
Any help is welcome!
I have achieve create the makeFile. It's working properly in Windows. I execute cmake and from the code files it create the visual studio project properly and it works fine.
BUT when I try to execute the make command in LINUX I get errors :S:
*In function ..... error: 'infinity' des not name a type const auto....
*.... error: 'infinity' was not declared in this scope
*.... error: 'infinity' was not declared in this scope
*.... error: 'infinity' was not declared in this scope
The line where is the problem is this one:
const auto infinity = std::numeric_limits<int>::infinity();
It's a line from this project: https://github.com/soimy/munkres-opencv/tree/master/src
I think the problem is defining a infinity limit... Could anyone lead me to solve this problem?
THANKS!!!
I'm writting hellow-world program using gsoap v 2.8 and trying to compile it in Visual Studio 2010. I want to use stl-vector functionality. But there are import errors in directive
#import "import/stlvector.h"
The error:
error C1083: Cannot open type library file: 'r:\work\vs2010\xmlme\xmlme\import\stlvector.h' Error while loading library r:\work\vs2010\xmlme\xmlme\xmlme.h
And consequence:
IntelliSense: cannot open source file "R:/Work/VS2010/XmlMe/XmlMe/Debug/stlvector.tlh" r:\work\vs2010\xmlme\xmlme\xmlme.h
Cannot figure out what Intellisense wants from me. I copied import folder from gsoap directory to my project and referencing it properly as I think.
my solution archive (link may expire)
UPDATE:
I've tried -s parameter for wsdl2h utility to exclude stl-dependency from xmlme.h file. And now I've similar error:
error C1083: Cannot open type library file: soap12.h: Error while loading library. xmlme\xmlme.h
... producing the same weird consequence:
IntelliSense: cannot open source file "XmlMe/Debug/soap12.tlh" \xmlme\xmlme.h
The thing is to not include XmlMe.h (file generated with wsdl2h.exe tool) in the project. It uses soapcpp2-compliant language (C-based but not C and that's why VS10 compiler generates error when including such a file).
Also you need to include .nsmap file, for e.g. in your main function definition file.
I use Cmake to generate VS project, based on some dll file by
if(WIN32)
MESSAGE(WINDOWS)
LINK_LIBRARIES(${***_Test_SOURCE_DIR}/../../Build/Win32/Release/***.dll)
else(WIN32)
MESSAGE(POSIX)
LINK_LIBRARIES(${***_Test_SOURCE_DIR}/../../Build/POSIX/lib***.so)
endif(WIN32)
But when I open the generated project, build and it throw out
\***.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2B0
Is anyone has ideas?
If do not use CMake, how to add external dll(not reference to some project) file in VS project. Is there any strict steps I can follow?
Thanks
On Windows, you need to link against .lib and not against a .dll, that's stupid, but Microsoft uses the same .lib extension for static and dynamic libraries. There should be ***.lib somewhere in ${***_Test_SOURCE_DIR}/../../Build/Win32/Release/.
LINK_LIBRARIES(${***_Test_SOURCE_DIR}/../../Build/Win32/Release/***.lib)
If it is not the case, you can follow this article to build a .lib from a .dll: How To Create 32-bit Import Libraries Without .OBJs or Source. Briefly (taken from Adrian Henke’s Blog), within a VS command prompt:
dumpbin /exports C:\yourpath\yourlib.dll
This will print quite a bit of text to the console. However we are only interested in the functions:
ordinal hint RVA name
1 0 00017770 jcopy_block_row
2 1 00017710 jcopy_sample_rows
3 2 000176C0 jdiv_round_up
4 3 000156D0 jinit_1pass_quantizer
5 4 00016D90 jinit_2pass_quantizer
6 5 00005750 jinit_c_coef_controller
...etc
Now copy all those function names (only the names!) and paste them into a new textfile. Name the nextfile yourlib.def and put the line “EXPORTS” at its top. My yourlib.def file looks like this:
EXPORTS
jcopy_block_row
jcopy_sample_rows
jdiv_round_up
jinit_1pass_quantizer
jinit_2pass_quantizer
jinit_c_coef_controller
...
Now from that definition file, we can finally create the .lib file. We use the “lib” tool for this, so run this command in your Visual Studio Command Prompt:
lib /def:C:\mypath\mylib.def /OUT:C:\mypath\mylib.lib
There is one idl file defined in microsoft sdk which is not available in VS2005. I am using some of the interfaces from that IDL.
Now this works fine on VS 2010 . I want to make it compile on VS2005.
I copied the header file to my project directory. But it is giving me compilation error.
When I looked into header file , the class id is defined in it as
EXTERN_C const CLSID CLSID_Xyz.
Now it is defined as extern so it means it should be declared somewhere else in code.
So my question is just including .h file is sufficient or do I need to also include _i.c file.
Any suggestions
Once you examine that _i.c file you'll see the indeed the CLSID constants are defined there. So yes, you need to incorporate that .c file into you program - either by #including it into a .c or .cpp file or just by adding it to your project so that it compiles separately and then links into the final binary.