Board index » cppbuilder » BDS2006: Delphi-Component, C++Builder needs *.OBJ-file

BDS2006: Delphi-Component, C++Builder needs *.OBJ-file


2007-01-14 01:14:20 AM
cppbuilder96
I have again the problem that after successfull installing Delphi-Components
the (C++Builder-)linker misses an *.OBJ-file. There are some infos in the newsgroups
that BDS2006 doesn't need *.OBJ-files anymore and that the *.LIB-file should
be added to the project. My questions are as follows:
1. What means "adding the *.LIB-File to the project"? And which *.LIB-file -
that of the created package (let's name the package COMPD10.bpl)?
2. When I add the component to the form there are two pragmas added:
#pragma link "COMPDerived"
#pragma link "COMPBase"
Is that sufficient?
To clarify: Installed is COMPDerived, COMPBase is defined in the uses-section
of that component. In more detail the package has the following structure:
Delphi-Package COMPD10.bpl:
---------------------------
...contains
COMPReg.pas
COMPReg.pas:
------------
procedure Register;
begin
RegisterComponents( '...', [TCOMPDerived]);
end;
COMPDerived.pas
---------------
unit COMPDerived;
interface
uses ...
COMPBase,
...
type
TCOMPDerived = class(TCOMPBase)
...
3. When I (1) use the Linker-option "Generate all C++Builder files" only the *.HPP-files
are created. What means then here "all"? And when I (2) select "Generate C++ object
files" with "Generate header files" I MUST use Build, otherwise the *.OBJ-files
aren't created. Needed some time to figure that out.
There are two other options
- "Include namespaces"
- "Export all symbols"
Must these options be checked?
When I now try to install the component, I get the error message
[Pascal Warning] W1031 Package '.COMPD10' will not be written to disk because
-J option is enabled
Only with (1) package installation is successful.
Any comments and hints?
Many thanks in advance.
Udo
 
 

Re:BDS2006: Delphi-Component, C++Builder needs *.OBJ-file

In article < XXXX@XXXXX.COM >,
Udo Weik < XXXX@XXXXX.COM >wrote:
Quote
When I (1) use the Linker-option "Generate all C++Builder files" only the
*.HPP-files
are created.
It should generate .hpp and .lib files. What used to be generated as
.obj files is now included in the .lib files and can be linked in their
place. If you are expecting a COMPDerived.obj file look for the
COMPDerived.lib file. make sure the path to the .lib file is in your
linker options paths. You can also choose to add the .lib file directly
into your project.
--
-David Dean
CodeGear C++ QA Engineer
 

Re:BDS2006: Delphi-Component, C++Builder needs *.OBJ-file

Hello David,
Quote
>When I (1) use the Linker-option "Generate all C++Builder files" only the
>*.HPP-files
>are created.

It should generate .hpp and .lib files. What used to be generated as
..obj files is now included in the .lib files and can be linked in their
place.
But what must I do when I want additionally an *.obj-file?
Quote
If you are expecting a COMPDerived.obj file look for the
COMPDerived.lib file. make sure the path to the .lib file is in your
linker options paths.
There is a path to that *.lib-file.
Quote
You can also choose to add the .lib file directly into your project.>
After that problem occured again, I tried to add that file via a
#pragma link "FILE.lib" in the corresponding *.cpp-file. That didn't
work, so the next approach was to add the *.lib-file to the project via
the Project Manager. That worked, but is of course inconvenient.
So I tried the #pragma link again, but changed the order of the *.lib-
file and that was the solution: when the *.lib-file is one of a component
package, it must be placed BEFORE the first #pragma links of the components
or much better at the top of the *.cpp-file. In another case (not direct
component related) the order doesn't make any difference.
I wasted again many hours with that problem. What I not understand is
that under certain circumstances a *.lib-file must be explicitly added
to the *.cpp-file, whereas other files related to the component are added
automatically (as #pragma link and as #include). From my point of view
that's not correct - there must be a bug. The linker seems not to be able
to resolve the declaration - I assume that the linker finds the file,
but too late?
Additional question: When I add a *.pas-file to a project, what must I
do that a *.hpp-file (and maybe a *.obj) ONLY of that *.pas-file is created?
Sometimes I have the problem that these files aren' created/updated
automatically.
Thanks and greetings
Udo
 

{smallsort}

Re:BDS2006: Delphi-Component, C++Builder needs *.OBJ-file

In article < XXXX@XXXXX.COM >,
Udo Weik < XXXX@XXXXX.COM >wrote:
Quote
>It should generate .hpp and .lib files. What used to be generated as
>..obj files is now included in the .lib files and can be linked in their
>place.

But what must I do when I want additionally an *.obj-file?
I'm not clear on why you would need an *.obj file in addition to the
*.lib file. Forgive my ignorance.
Quote
After that problem occured again, I tried to add that file via a
#pragma link "FILE.lib" in the corresponding *.cpp-file. That didn't
work, so the next approach was to add the *.lib-file to the project via
the Project Manager. That worked, but is of course inconvenient.
I agree that it is inconvenient to have to add the *.lib file to the
project. I ran into this problem occasionally as well before joining
CodeGear. I haven't been able to reproduce this since.
Quote
So I tried the #pragma link again, but changed the order of the *.lib-
file and that was the solution: when the *.lib-file is one of a component
package, it must be placed BEFORE the first #pragma links of the components
or much better at the top of the *.cpp-file. In another case (not direct
component related) the order doesn't make any difference.
That is an interesting work around. I need to print this out and save
it to my folklore for this issue.
Quote
I wasted again many hours with that problem. What I not understand is
that under certain circumstances a *.lib-file must be explicitly added
to the *.cpp-file, whereas other files related to the component are added
automatically (as #pragma link and as #include). From my point of view
that's not correct - there must be a bug. The linker seems not to be able
to resolve the declaration - I assume that the linker finds the file,
but too late?
Yes, I'd like to learn more about why this is happening as well. I
recall seeing the #pragma created as: #pragma link "something" and the
linker asking for the .obj file, but then twiddling with the project and
having it be happy finding the .lib file.
Quote
Additional question: When I add a *.pas-file to a project, what must I
do that a *.hpp-file (and maybe a *.obj) ONLY of that *.pas-file is created?
Sometimes I have the problem that these files aren' created/updated
automatically.
I'm not sure what you are asking here. Are you not able to choose
compile from the run menu when the file is open? (I do see that compile
is missing from the project manager's context menu) Something that may
help is that you can reorder the project so that the .pas file is
compiled first. This is the first step I take when I add a .pas file to
a C++ project, and it takes care of the .hpp issues that I usually have.
--
-David Dean
CodeGear C++ QA Engineer
<blogs.codegear.com/ddean/>