Re: How to debug Link errors of static LIB in eVC?

Tech-Archive recommends: Fix windows errors by optimizing your registry




"CEasker" <CEasker@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:2A550D7A-9D4A-4B6A-9E87-20B70DD82A6A@xxxxxxxxxxxxxxxx
The platform of my device is CE4.2,I check CE 4.2 winreg.h,the code
#ifdef __cplusplus
extern "C" {
#endif
can also be found.
Please keep in mind that there can be multiple SDKs installed.

I am sure that correct version of winreg.h is in the
directory of the header file which I had set.
Ok, but your compiler finds somehow the C++ prototype of the function and generates the decorated name for the unresolved external. You should investigate, how the compiler finds this prototype. I see two approaches. First I would change the C++ compiler settings so that the preprocessor output is saved: "Generate Preprocessed header" ... or so (*).
This will cause a win32.i file to be save. This is the input file that the C++ compiler really gets. Here you can see, how the #ifdefs and #defines have worked. It's a large file but you should find it. Additionally you can check if the eVC++ 4.0 allows to show the included header files. It's possible with VS2005 but I am not sure with the older compiler. Here you can verfy what files are really included and get a list of suspected files. This may give you a hint.

(*) You will only be able to generate the real OBJ output if you disable this setting. ;-)

In addtion, can you give me a explaination for the error as below
ptlibce.lib(win32.obj) : error LNK2001: unresolved external symbol

Do you mean this?
ptlibce.lib(win32.obj) : error LNK2001: unresolved external symbol "class
PPlugin_PSoundChannel_WAVFile_Registration
PPlugin_PSoundChannel_WAVFile_Registration_Instance"
(?PPlugin_PSoundChannel_WAVFile_Registration_Instance@@3VPPlugin_PSoundChannel_
WAVFile_Registration@@A)

The linker is missing a function (C++ decorated) PPlugin_PSoundChannel_WAVFile_Registration_Instance that returns a PPlugin_PSoundChannel_WAVFile_Registration class object. Check what (import-)library defines this symbol and add it to the linker input. If you have enough paranoia you can check with "dumpbin /symbols" or "dumpbin /exports" if the symbol is really exported. Since the function returns a class object I dont suspect a wrong prototype.

Best regards
Helge

.



Relevant Pages

  • Re: How to debug Link errors of static LIB in eVC?
    ... directory of the header file which I had set. ... how the compiler finds this prototype. ... PPlugin_PSoundChannel_WAVFile_Registration class object. ... "dumpbin /exports" if the symbol is really exported. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Header file included more than once?
    ... even when I started the header file with #ifndef etc etc statements? ... Define structs in one of the .c files and declare ... if a variable is both declared as extern and defined). ... the compiler that it is defined somewhere else, ...
    (comp.lang.c)
  • Re: java.lang.UnsatisfiedLinkError - native method
    ... compiler, or a C++ compiler? ... Is the failing method declared with extern "C"? ... you in the generated header file. ... (JNIEnv *, jobject, jlong, jlong, jlong); ...
    (comp.lang.java.programmer)
  • Re: extern "C"
    ... to add extern "C" to both declaration and definition? ... extern "C" specifies external linkage spec for the functions that you ... You would have a header file and you keep ... the compiler is able to see that the function has already ...
    (microsoft.public.vc.language)
  • Re: java.lang.UnsatisfiedLinkError - native method
    ... compiler, or a C++ compiler? ... Is the failing method declared with extern "C"? ... you in the generated header file. ... javah provided is no longer helping you. ...
    (comp.lang.java.programmer)