Board index » cppbuilder » [Linker Error] Unresolved external '__fastcall Word_2k::TWordApplication::GetDefaultInterface()' referenced from ....WORDMERGE2000.OBJ
roladdon
![]() CBuilder Developer |
roladdon
![]() CBuilder Developer |
[Linker Error] Unresolved external '__fastcall Word_2k::TWordApplication::GetDefaultInterface()' referenced from ....WORDMERGE2000.OBJ2004-06-16 10:57:27 AM cppbuilder34 I Created a new Application. I put The word2000 interface into a seperat TThread. Now I am getting the error: [Linker Error] Unresolved external '__fastcall Word_2k::TWordApplication::GetDefaultInterface()' referenced from ....WORDMERGE2000.OBJ What am I missing ? (I do not have any reference to the Word2000 on the Main form) Roland |
Jean-Marie Babet
![]() CBuilder Developer |
2004-06-17 01:24:59 AM
Re:[Linker Error] Unresolved external '__fastcall Word_2k::TWordApplication::GetDefaultInterface()' referenced from ....WORDMERGE2000.OBJ
Hello Roland,
There are many ways to track down 'Unresolved external'. The one approach that I've used successfully is as follows: 1. First find out who is making a reference to this symbol. From the error message it seems that the module WORDMERGE2000 is making the reference. Now, is WORDMERGE2000 a source module of your project [i.e. WORDMERGE2000.CPP/C] or is it part of a library [or an explicit .OBJ file] that you're linking with. 2. Find out why that module is making the reference. Say WORDMERGE2000.CPP is a source module. You can just grep/search for references to that symbol. If you can't find it, then it's probably being generated implicitly. The quick way to find this out is to generate assembly from the .CPP file. The '-S' switch on the BCC32 will do the trick [Here you can export your project to a makefile and then you can tweak the BCC32 options in the makefile to have the '-S' or you can simply invoke make as follows: Quotemake -f projectMakefile.make WORDMERGE.ASM Nested in the .ASM file you'll find the C++ statement that resulted in the assembly reference. At this point it should be easy to see why the compiler made a reference to that symbol. NOTE: I assume you've Rebuild the project fully to eliminate the case where there's an old .OBJ that's dangling around that's out of sync. with your code. If in case #1 WORDMERGE2000.OBJ is an explicitly .OBJ someone gave you, or it's part of a library you're using, then we use TDUMP instead of the assembly route but the idea is the same... Let me know if that's the case and I'll elaborate. Let me know if any of the above is not clear. Regards, Bruneau. "roladdon" < XXXX@XXXXX.COM >wrote in message QuoteI Created a new Application. |
roladdon
![]() CBuilder Developer |
2004-06-17 02:40:48 AM
Re:[Linker Error] Unresolved external '__fastcall Word_2k::TWordApplication::GetDefaultInterface()' referenced from ....WORDMERGE2000.OBJ
Let me explain exactly what I have done:
(That's the first time for me that I did Word2000 automat.) I opened a new project in CBuilder 6 I dropped a TWordApplication on to the main form - and played arround with it - to see if it works. Then I deleted the TWordApplication. I made a new class: #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include "Word_2K_SRVR.h" #include <OleServer.hpp> class TWordMerge2000 : public TWordApplication ..... I run my TWordMerge2000 from the main form via a button - and everything was working fine. Now I made a new TThread and put my TWordMerge2000 in it. That's when I had to add the line CoInitialize(NULL); and CoUninitialize(); Even though the program worked perfectly - there was an error now when exiting the program: "src->QueryInterface ........ The app called an interface that was marshalled for a different thread" I removed all references to Word_2K and OLE from the MainForm and it's header - but the error still happened. So I decided to start from scratch: I made a new Application and added my TThread from before. Now I am getting the error Unresolved external '__fastcall Word_2k::TWordApplication::GetDefaultInterface()' referenced from ....WORDMERGE2000.OBJ I did use GetDefaultInterface()->Visible = False; in my TWordMerge2000 class. So I deleted that line. But the error is still there. In the meanwhile I did put everything back into the mainform - because I am under time constraints - and because I needed a working copy. thanks for all your help, Roland {smallsort} |
Jean-Marie Babet
![]() CBuilder Developer |
2004-06-17 03:48:04 AM
Re:[Linker Error] Unresolved external '__fastcall Word_2k::TWordApplication::GetDefaultInterface()' referenced from ....WORDMERGE2000.OBJ
Hello Roland,
QuoteSo I decided to start from scratch: routine that supplies the interface upon which all methods of TWordApplication act. So if you are using TWordMerge2000, definitely TWordApplication::GetDefaultInterface is being pulled in. I suspect that the issue is related to the fact that by not explicitly dropping the component on the form, your module is not explicitly telling the linker to pull in the relevant module. You see, when you drop a TWordApplication [or some other component] on the form, the IDE's code manager adds the following to the corresponding .CPP file: #pragma link "Word_2K_SRVR" This tells the compiler to tell the linker [via a COMMENT record] to link in Word_2K_SRVR.obj. Now, if you are using the component behind the scene - like programmatically in a TThread derived class - the compiler is no longer told to explicitly pull in this .OBJ. Hence, you end up with Linker errors. Please add the pragma line mentioned in the .CPP where TWordMerge2000 is implemented. Regards, Bruneau. "roladdon" < XXXX@XXXXX.COM >wrote in message QuoteLet me explain exactly what I have done: |
roladdon
![]() CBuilder Developer |
2004-06-17 04:42:58 AM
Re:[Linker Error] Unresolved external '__fastcall Word_2k::TWordApplication::GetDefaultInterface()' referenced from ....WORDMERGE2000.OBJ
Yes - I did already try that, - to add #pragma link "Word_2K_SRVR" and I
also tried to add the Word_2K_SRVR object file directly to my project. - there was no change. For now I have put everything back into the MainForm - I am moving everything else into threads (the file processing and transfer) Thanks again for your help. Roland |