BCB6 Excel-Komponente zofft sich mit <Comctrls.hpp>



  • Wenn ich auf einem Formular eine der mitgelieferten Office-Komponenten unterbringe, und dann noch eins der Common-Controls aus der "Win32"-Leiste dort platziere, gibt es sofort knatsch beim Kompilieren:

    [C++ Fehler] ComCtrls.hpp(2638): E2015 Mehrdeutigkeit zwischen 'Windows' und 'Excel_97::Windows'

    Wohlgemerkt: alles standardmässige Borland-gelieferte Komponenten. Wundert mich etwas. Muss ich jetzt wirklich auf die TreeViews verzichten?

    Wenn jemand Rat weiß, würde ich mich sehr freuen davon zu hören.



  • Ein Zwischenstand: bei bdn finden sich einige Beiträge zum Thema, aber keine funktionierenden Lösungen.

    Borland schlägt einen "undocumented hack" der TLIBIMP.SYM vor:

    It's fairly common that there are name conflicts when importing a type
    library. For example, some typeLibraries even use identifier names that are
    reserved keywords in C++. To address this issue we have an undocumented
    hack: The code generator looks for a file by the name of TLIBIMP.SYM. This
    file is a text file that simply list a bunch of identifiers that the Code
    generator should treat as C++ reserved words. It sounds like you'll need to
    add 'Windows' to this file. Most likely we never encountered the problem
    because we never mixed WORD_TLB.H and RICHEDIT.HPP. However, you'll find out
    that there are already a bunch of identifiers in that file and they were the
    result of importing several well-known typelibraries.
    Note: This workaround only applies to C++Builder 3 and C++Builder 4

    Das stimmt tatsächlich: der Workaround funktioniert _nicht_ bei C++ Builder 6. Weiß jemand eine Lösung?



  • Einfach dafür sorgen, dass die Office-Header nach ComCtrls.hpp inkludiert werden (im Unit-Header).



  • Super Jansen!
    Danke- es funktioniert! Man muss nur aufpassen, in _allen_ Projektdateien, in denen Excel-Server inkludiert werden, jeweils vorweg die ComCtrls zu includen.


Anmelden zum Antworten