Solved

include a *.lib file (C-Builder)

Posted on 2001-09-14
49
3,604 Views
Last Modified: 2013-11-18
hi
i tried to include a *.lib file in my project. the c++builder added following line to my cpp file:
USELIB("papi.lib");
after adding this line, i can't compile anymore...
the compiler awaits a ')' (E2293)

what's going wrong?
THX for help
0
Comment
Question by:MegaPam
  • 20
  • 15
  • 6
  • +5
49 Comments
 
LVL 6

Expert Comment

by:DrDelphi
ID: 6484972
directly from the BCB help file:

Library

(Command-line equivalent: -Lpath, where path = directory path)

Use the Library option to specify the directories that contain the C++Builder startup object files (C0x.OBJ), run-time library files (.LIB files), and all other .LIB files. By default, the linker looks for them in the directory containing the project file (or in the current directory if you?re using the command-line compiler).

You can also use the linker option /Lpath to specify the library search directories when you link files from the command line.


AND...


Library file search algorithms

The library file search algorithms are similar to those for include files:
     Implicit libraries: The Borland C++ compiler searches for implicit libraries only in the specified library directories; this is similar to the search algorithm for #include <somefile>.

Implicit library files are the ones the compiler automatically links in and the start-up object file (C0x.OBJ).

Explicit libraries: Where the compiler searches for explicit (user-specified) libraries depends in part on how you list the library file name. Explicit library files are ones you list on the command line or in a project file; these are file names with a .LIB extension.

If you list an explicit library file name with no drive or directory (like this: mylib.lib), the compiler first searches for that library in the current directory. If the first search is unsuccessful, the compiler looks in the directories specified with the Library (-L) option. This is similar to the search algorithm for #include "somefile".
     If you list a user-specified library with drive and/or directory information (like this: c:\mystuff\mylib1.lib), C++Builder searches only in the location you explicitly listed as part of the library path name and not in any specified library directories.



Good luck!!
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6485665
>>to my cpp file: USELIB("papi.lib");
not in cpp file, but in mak file (BCB4) or bpr file (BCB5)
0
 

Author Comment

by:MegaPam
ID: 6487170
DrDelphi,
the lib file is in the same directorty as the project file.

AlexVirochovsky,
the c++builder added this line autom. to my cpp file...
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6491543
If papi.lib is a static library that made by other compilers as VC++,  you can not link it with C++ Builder.
I assume papi.lib is a import library of papi.dll.

Note that, C++ Builder doesn't understand  the import library of VC++. Therefore, you need
rebuilder the import library from dll. Borland provides the utility "implib" for that job.

             implib -a papi  papi.dll

The above command will produce papi.lib that can work with C++ Builder


Moverover, if papi wrote for C, you need something like

extern "C"
{
     #include    ....    //  header files of papi
}

-------------------------------------------
FYI

implib

Borland Implib Version 3.0.8 Copyright (c) 1991, 1999 Inprise Corporation

Syntax: IMPLIB [options] libname[.lib] [@respfile | srcname] [srcname ...]
 Options:
    -a     Add '_' alias for MS flavor cdecl functions
    -c     Case sensitive symbols
    -f     Force imports by name (with hints)
    -w     No Warnings

Respfile may contain a list of source files to process.
Wildcards are ok for .DLL and .DEF file names.
0
 
LVL 2

Expert Comment

by:smitty1276
ID: 6491613
I'm not sure for you're compiler, but in VC++ you can add this line to link to a directory...

#pragma comment (lib, "myLib.lib")     /* link with myLib lib*/
0
 
LVL 2

Expert Comment

by:smitty1276
ID: 6491615
Sorry, that should read "you can add this line to link to a library..."
0
 

Author Comment

by:MegaPam
ID: 6492605
i made new library with implib from c++builder.
it's still teh same error.... the compiler messages looks like it would a syntax error....but the syntax was created by c++builder...

thienpnguyen
where can i get the header files used in papi.lib?
i don't know them, but you're right, the library is written in c and NOT in c++.

what are wildcards exactly, and what do u mean with "are ok dor.dll and .def file names"?


smitty1276
i also tried to use the #pragma statement,....there is no compiler error but the functions defined in the library was not recognized...
0
 
LVL 2

Expert Comment

by:bkdc
ID: 6493056
>>smitty1276
i also tried to use the #pragma statement,....there is no compiler error but the functions defined in
the library was not recognized...

 Unless you have the header file(s) you can't use the functions inside the library. Those headers (xxxx.h) should have come together with the lib file.

 There's one more thing - why are you messing with some lib when the sources are freely avalaible (headers included)?

http://icl.cs.utk.edu/projects/papi
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6493780
MegaPam,

You don't need to use wildcards in this case. Wildcard means "pa*.dll" can represent for papi.dll , pap.dll ....

It is better if you put error messages. As bkdc though, maybe the program has
error because you don't include header files for papi

0
 
LVL 2

Expert Comment

by:smitty1276
ID: 6495713
>the library was not recognized...
>Unless you have the header file(s) you can't use the
>functions inside the library. Those headers (xxxx.h)
>should have come together with the lib file.

That's true... I was thinking it was a lib she(?) had written, and therefore thought that the #pragma would work in the header.  

So YES, you need the headers.  I meant that you could place the #pragma IN THE HEADER FILE to ensure the linking.

0
 

Author Comment

by:MegaPam
ID: 6495735
the header file we downloaded from http://icl.cs.utk.edu/projects/papi gives tons of compiler errors.
the papi-package we downloaded from the card manufacturer (it's a profibus PCI-Card from www.softing.de) only includes a papi.dll and a papi.lib.
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6499157
Are you sure you down load all files you need from www.softing.de ?
I almost think you miss some files. When I come that side, I try to download
but it requires me to give my information .  Therefore, I stop to download.
Please, download again. Make sure download everything that gives you.
0
 

Author Comment

by:MegaPam
ID: 6499165
we already downloaded the package 2 times, it's an all in one package....and there is NO header file :o(
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6499203
Give me a specific  link I will try to help you.
0
 

Author Comment

by:MegaPam
ID: 6499213
0
 
LVL 2

Expert Comment

by:bkdc
ID: 6499833
It's so easy it just isn't fair (600 points just for downloading a file - thats really good :) ).

MegaPam - here's the story:
1. went to ftp.softing.com/pub/outgoing/pb_dmk/v523/pb_dmk_95.exe and downloaded the file
2. unzipped it
3. ran the installation
4. guess what i found in C:\Program Files\PROFIBUS\WIN95SDK ?
5. right! 2 folders: Papi and Samples
6. guess what's in Papi -> right again: a folder named "Inc_glb"
7. guess what's in there: the headers

So...thanx for the 600 points ;)

In case you have a "strange, poltergeist like" problem and you are unable to install those files, provide a working mail address or something and i'll send them to you
0
 

Author Comment

by:MegaPam
ID: 6505204
u smiled to early bkdc... :o)

i already downloaded the files and copied them to the same folder....but it's still the same error as it was on the beginning of the question....!
0
 
LVL 2

Expert Comment

by:bkdc
ID: 6505360
Forget about the smile, hehehe, the think is that if it still doesn't work you're in deep...well, you know.

>>i already downloaded the files and copied them to the same folder

and which folder would that be ?

what functions do you use and and headers have you included ?

There are some samples (in "...\WIN95SDK\Samples\"), do they compile ?

 I guess your boss is not very happy, why don't you contact the company that selled you the board ? Last think, have you tried another compiler ?
0
 

Author Comment

by:MegaPam
ID: 6505475
okay

we have a full working program for vc++ and we are now on the way to port it to c++builder.
the code i have, is the sample code adapted for our needs (it works with vc++).

i cpied the headers to the folder were my project is... i included alot of headers... hmm i don't think that the error is from header....it's a compiler error...and the error looks like a syntax error....

USELIB("papi.lib");
the compiler awaits a ')' (E2293)

0
 

Author Comment

by:MegaPam
ID: 6505537
okay

we have a full working program for vc++ and we are now on the way to port it to c++builder.
the code i have, is the sample code adapted for our needs (it works with vc++).

i cpied the headers to the folder were my project is... i included alot of headers... hmm i don't think that the error is from header....it's a compiler error...and the error looks like a syntax error....

USELIB("papi.lib");
the compiler awaits a ')' (E2293)

0
 
LVL 2

Expert Comment

by:bkdc
ID: 6505673
try this:

#pragma hdrstop
USELIB("papi.lib");
#include "papixxxx.h" //papi headers
0
 

Author Comment

by:MegaPam
ID: 6505769
still the same
0
 
LVL 2

Expert Comment

by:bkdc
ID: 6505831
in this case try changing the path:
USELIB("./papi.lib");
or
USELIB("../papi.lib");

it depends on what bcc considers to be the root directory of your project.

just a test: put a bogus name instead of papi and see if you get the same error: eg. USELIB("damn.lib");
If so, the reason is bcc is unable to find the library



0
 

Author Comment

by:MegaPam
ID: 6511609
./ and ../ didn't make any change to the error. USELIB("damn.lib"); either....
very strange...
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Expert Comment

by:bkdc
ID: 6512106
could you post the code before the USELIB(....) line; form the start of the file till after USELIB
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6512177
Tonight is a weekend, I will help you. But I want to make sure, I understand clearly your problem

1. You said your project works with VC++ and now
     you have problem when you port it to C++ Builder.
    Is it right ?

2. Could you show your problem by creating a very simple project  
    in which you call some function of papi.

   
0
 

Author Comment

by:MegaPam
ID: 6516361
1. yes, you're right.

2.
#include "keywords.h"

INCLUDES

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <windows.h>

#pragma hdrstop
USELIB("papi.lib");

#include "pb_type.h"
#include "pb_conf.h"
#include "pb_if.h"
#include "pb_err.h"
#include "pb_fmb.h"
#include "pb_dp.h"



/****************************************************************************/

...

#include "dpdemo.h"

...
...

FUNCTION LOCAL PB_BOOL dp_init_master_req
  (
  IN    VOID
  )
  /*------------------------------------------------------------------------*/
  /* FUNCTIONAL_DESCRIPTION                                                 */
  /*------------------------------------------------------------------------*/
  /*                                                                        */
  /* This function is used to define the DP-Master operating mode           */
  /* (e.g. class1/class2 master operation)                                  */
  /*                                                                        */
  /* possible return values:                                                */
  /*   - PB_TRUE                                                            */
  /*   - PB_FALSE                                                           */
  /*                                                                        */
  /*------------------------------------------------------------------------*/
{
LOCAL_VARIABLES

  T_DP_INIT_MASTER_REQ    init_master_req;
  T_PROFI_SERVICE_DESCR   sdb;


FUNCTION_BODY

  sdb.layer     = DP;
  sdb.service   = DP_INIT_MASTER;
  sdb.primitive = REQ;

  init_master_req.master_default_address = DP_MASTER_ADDRESS;
  init_master_req.master_class2          = PB_FALSE;                      /* master class 1 operation */
  init_master_req.lowest_slave_address   = 0;
#ifdef WINNT
  init_master_req.slave_io_address_mode  = DP_AAM_IO_BLOCKS;     /* only mode possible with NT driver */
#else
  init_master_req.slave_io_address_mode  = DP_AAM_ARRAY;     /* same amount of memory for every slave */
#endif
  init_master_req.clear_outputs          = PB_FALSE;  /* set outputs to 'clear' befor starting to poll*/
  init_master_req.auto_remote_services   = DP_AUTO_REMOTE_SERVICES; /* remote .ind handled by firmware*/
  init_master_req.cyclic_data_transfer   = PB_TRUE;

  sprintf (s, "DP_Init_Master.req [%d]", profi_snd_req_res (&sdb, &init_master_req, PB_FALSE));
  OUTPUT_STRING (s);

  PROFI_RCV_CON_IND (); /* macro to fetch a confirmation or indication */

  if ( (con_ind_sdb.service   == DP_INIT_MASTER) &&
       (con_ind_sdb.primitive == CON           ) &&
       (con_ind_sdb.result    == POS           ) )
  {
    sprintf (s, "DP_Init_Master.con [+]");
    OUTPUT_STRING (s);

    return (PB_TRUE);
  }

  sprintf (s, "DP_Init_Master.con [-]");
  OUTPUT_STRING (s);

  return (PB_FALSE);
} /* dp_init_master_req */

/****************************************************************************/

...
...

0
 

Author Comment

by:MegaPam
ID: 6516380
this function-call example is more clearly
ret_val = profi_init((USIGN8) board_number,0,0);
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6517932
I created a simple project and successly compile it.
The following is steps I did

1. Create new lib from papi.dll for C++ Builder

             implib  papi  papi.dll

     Note : before I suggest to use -a option, but in this case we don't use it. Because
                  #define CALL_CONV  APIENTRY

2. Create a simple project by C++ builder  

            Project1.bpr
            Unit1.h
            Unit1.dfm
            Unit1.cpp
            Project1.res
            Project1.exe
            Project1.cpp
3.   Add  papi.lib to that to the project. The code as following


        ///////// project1.cpp

       
        //---------------------------------------------------------------------------
        #include <vcl.h>
        #pragma hdrstop
        USERES("Project1.res");
        USEFORM("Unit1.cpp", Form1);
       
        USELIB("papi.lib");             //   <--------------- add papi.lib library
                                                      // Assume papi.lib to project's directory
       
        //---------------------------------------------------------------------------
        WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
        {
            try
            {
                 Application->Initialize();
                 Application->CreateForm(__classid(TForm1), &Form1);
                 Application->Run();
            }
            catch (Exception &exception)
            {
                 Application->ShowException(&exception);
            }
            return 0;
        }
        //---------------------------------------------------------------------------

4. In unit1.cpp, call  profi_init(...) to show we can use papi.dll

        //---------------------------------------------------------------------------
        #include <vcl.h>
        #pragma hdrstop
       
        #include <stdio.h>
        #include <stdlib.h>
        #include <string.h>
        #include <conio.h>
       
        #include "keywords.h"
        #include "pb_type.h"
        #include "pb_conf.h"
        #include "pb_if.h"
        #include "pb_err.h"
        #include "pb_fmb.h"
        #include "pb_dp.h"
       
       
        #include "Unit1.h"
        //---------------------------------------------------------------------------
        #pragma package(smart_init)
        #pragma resource "*.dfm"
        TForm1 *Form1;
        //---------------------------------------------------------------------------
        __fastcall TForm1::TForm1(TComponent* Owner)
            : TForm(Owner)
        {
        }
        //---------------------------------------------------------------------------
       
        // demo to call some function in papi.lib
        void foo()
        {
            int board_number = 1;
            int ret_val = profi_init((USIGN8) board_number,0,0);
        }

5. I successly compile it project.

Good luck.
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6517941
Note : I use WinNT, therefore I download pb_dmk_nt.exe.
0
 

Author Comment

by:MegaPam
ID: 6518778
Hi thienpnguyen

thanks for your help!

we tested the same sample as u gave us... and it worked.
now, the problem is, the application we have to port is a console programm without any form. that means we have no  >> project1.cpp and unit1.cpp << , we only have ONE file, >> project1.cpp <<
0
 

Author Comment

by:MegaPam
ID: 6518782
if you'll help me to get the program working, you will receive 900 points from me.
it's very important for me to get that stuff working, so thanks alot (!!!) for your help!
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6518961
1. Create new lib from papi.dll for C++ Builder

                      implib  papi  papi.dll

3.  Create simple console project by

      Choose menu :   File / New / Console Wizard ... And  you have

             Project1.bpr
             Unit1.cpp
             Project1.bpf

3. Add papi.lib to project  by  choosing menu   Project / Add to Project


4. In unit1.cpp, call  profi_init(...) to show we can use papi.dll


        //---------------------------------------------------------------------------
       
        #pragma hdrstop
        #include <stdio.h>
        #include <stdlib.h>
        #include <string.h>
        #include <conio.h>
       
        #include <windows.h>
        #include "keywords.h"
        #include "pb_type.h"
        #include "pb_conf.h"
        #include "pb_if.h"
        #include "pb_err.h"
        #include "pb_fmb.h"
        #include "pb_dp.h"
        //---------------------------------------------------------------------------
       
        #pragma argsused
        int main(int argc, char* argv[])
        {
            return 0;
        }
        //---------------------------------------------------------------------------
       
        // demo to call some function in papi.lib
        void foo()
        {
            int board_number = 1;
            int ret_val = profi_init((USIGN8) board_number,0,0);
        }

5. I successly compile it project.
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6518990
I think with the console project, we can not put USELIB("papi.lib"); in unit1.cpp
We need to use menu to add papi.lib


0
 

Author Comment

by:MegaPam
ID: 6519040
if i add the lib file over the menu, the USLIB line is added autom.
i deleted the line, and the project compiled....but where is the lib file defined now?
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6519087
If I use C++ builder version 5, I have the file Project1.bpf
Its content is



          USEUNIT("Unit1.cpp");
          USELIB("papi.lib");
         //---------------------------------------------------------------------------
         This file is used by the project manager only and should be treated like the project file

         main

0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6519095
Moreover, Project1.bpr also contain information about papi.lib
0
 

Author Comment

by:MegaPam
ID: 6519102
we don't have such a *.bpf file (C++Builder 4)


0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6519113
That means Project1.bpr  will contain information about papi.lib.
Project1.bpr is a text file. You can easily read  it.
0
 

Author Comment

by:MegaPam
ID: 6519236
i can't find anything in this file:

# ---------------------------------------------------------------------------
!if !$d(BCB)
BCB = $(MAKEDIR)\..
!endif

# ---------------------------------------------------------------------------
# IDE-ABSCHNITT
# ---------------------------------------------------------------------------
# Der folgende Abschnitt der Make-Datei des Projekts wird von der IDE verwaltet.
# Wir empfehlen, ?nderungen an diesem Abschnitt nur ?ber die IDE
# vorzunehmen.
# ---------------------------------------------------------------------------
VERSION = BCB.04.04
# ---------------------------------------------------------------------------
PROJECT = Project1.exe
OBJFILES = Project1.obj
RESFILES =
RESDEPEN = $(RESFILES)
LIBFILES =
IDLFILES =
IDLGENFILES =
LIBRARIES =
SPARELIBS =
PACKAGES =
DEFFILE =
# ---------------------------------------------------------------------------
PATHCPP = .;
PATHASM = .;
PATHPAS = .;
PATHRC = .;
DEBUGLIBPATH = $(BCB)\lib\debug
RELEASELIBPATH = $(BCB)\lib\release
SYSDEFINES = _NO_VCL
USERDEFINES =
# ---------------------------------------------------------------------------
CFLAG1 = -I$(BCB)\include -Od -w -Tkh30000 -r- -a8 -k -y -v -vi- -c -tWM -tWC \
  -D$(SYSDEFINES);$(USERDEFINES)
IDLCFLAGS = -src_suffixcpp
PFLAGS = -U$(BCB)\lib;$(DEBUGLIBPATH) -I$(BCB)\include -$YD -$W -$O- -v -JPHN -M
RFLAGS = -i$(BCB)\include
AFLAGS = /i$(BCB)\include /mx /w2 /zd
LFLAGS = -L$(BCB)\lib;$(DEBUGLIBPATH) -ap -Tpe -x -Gn -v
# ---------------------------------------------------------------------------
ALLOBJ = c0x32.obj $(OBJFILES)
ALLRES = $(RESFILES)
ALLLIB = $(LIBFILES)  import32.lib cw32mt.lib
# ---------------------------------------------------------------------------
!ifdef IDEOPTIONS

[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=2055
CodePage=1252

[Version Info Keys]
CompanyName=
FileDescription=Executable (Console)
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=

[Debugging]
DebugSourceDirs=

[Parameters]
RunParams=
HostApplication=
RemoteHost=
RemotePath=
RemoteDebug=0

[Compiler]
InMemoryExe=0
ShowInfoMsgs=0

!endif

# ---------------------------------------------------------------------------
# MAKE-ABSCHNITT
# ---------------------------------------------------------------------------
# Der folgende Abschnitt der Datei des Projekts wird nicht von der IDE verwendet. Er ist
# f?r das Erstellen von der Befehlszeile mit dem Programm MAKE gedacht.
# ---------------------------------------------------------------------------

.autodepend
# ---------------------------------------------------------------------------
!if !$d(BCC32)
BCC32 = bcc32
!endif

!if !$d(DCC32)
DCC32 = dcc32
!endif

!if !$d(TASM32)
TASM32 = tasm32
!endif

!if !$d(LINKER)
LINKER = ilink32
!endif

!if !$d(BRCC32)
BRCC32 = brcc32
!endif

!if !$d(IDL2CPP)
IDL2CPP = idl2cpp
!endif

# ---------------------------------------------------------------------------
!if $d(PATHCPP)
.PATH.CPP = $(PATHCPP)
.PATH.C   = $(PATHCPP)
!endif

!if $d(PATHPAS)
.PATH.PAS = $(PATHPAS)
!endif

!if $d(PATHASM)
.PATH.ASM = $(PATHASM)
!endif

!if $d(PATHRC)
.PATH.RC  = $(PATHRC)
!endif
# ---------------------------------------------------------------------------
$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)
    $(BCB)\BIN\$(LINKER) @&&!
    $(LFLAGS) +
    $(ALLOBJ), +
    $(PROJECT),, +
    $(ALLLIB), +
    $(DEFFILE), +
    $(ALLRES)
!
# ---------------------------------------------------------------------------
.pas.hpp:
    $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }

.pas.obj:
    $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }

.cpp.obj:
    $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }

.c.obj:
    $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }

.asm.obj:
    $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@

.rc.res:
    $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
# ---------------------------------------------------------------------------
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6520067
ask to patrick (pmarchionni@baumerelectric.com)
He was same problem. May be he solved it...
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6520607
your file Project1.bpr  doesn't contain papi.lib, because at this time
you don't save your project. After you save the project, you will see papi.lib
in Project1.bpr

Here is the Project1.bpr in  version 4 format

# ---------------------------------------------------------------------------
!if !$d(BCB)
BCB = $(MAKEDIR)\..
!endif

# ---------------------------------------------------------------------------
# IDE SECTION
# ---------------------------------------------------------------------------
# The following section of the project makefile is managed by the BCB IDE.
# It is recommended to use the IDE to change any of the values in this
# section.
# ---------------------------------------------------------------------------

VERSION = BCB.04.04
# ---------------------------------------------------------------------------
PROJECT = Project1.exe
OBJFILES = Project1.obj
RESFILES =
RESDEPEN = $(RESFILES)
LIBFILES = papi.lib                                                              <<<<<<<<<<<<<< papi.txt
IDLFILES =
IDLGENFILES =
LIBRARIES =
SPARELIBS =
PACKAGES = Vcl40.bpi Vclx40.bpi nmfast40.bpi dclocx40.bpi ibsmp40.bpi Vcldb40.bpi \
  dclusr40.bpi rxctl4.bpi rxdb4.bpi bcbsmp40.bpi Qrpt40.bpi vcldbx40.bpi \
  TeeUI40.bpi teedb40.bpi tee40.bpi Icsbcb40.bpi
DEFFILE =
# ---------------------------------------------------------------------------

....................................................
0
 

Author Comment

by:MegaPam
ID: 6522863
AlexVirochovsky:

I am patrick



thienpnguyen:

now i get following linker error... (if i delete USELIB line)


[Linker Error] Unresolved external 'profi_init' referenced from C:\EIG_DAT\PROJEKTE\PROFIBUSEXPERT\PROJECT1.OBJ.
0
 
LVL 6

Expert Comment

by:thienpnguyen
ID: 6523732
Do you do step by step as I show you ?
In fact, I successsly compiled and linked.
Do you want to send the my sample project in
c++ Builder to you ? In if you want, please give me
your email address.
0
 
LVL 6

Accepted Solution

by:
thienpnguyen earned 300 total points
ID: 6525661
You can download  my sample project at

http://vnucla.hypermart.net/MegaPam/Console.zip

Note project wrote for NT
0
 

Author Comment

by:MegaPam
ID: 6526225
Wow, thanx very much. i found the error.
Thanx alot for your endurance...

the error was really studpid...
the i didn't include the condefs.h header... :o|
0
 

Author Comment

by:MegaPam
ID: 6526230
0
 

Expert Comment

by:adriano_caye
ID: 20444167
I appreciate this solution. I've had exactly the same problem. I was stuck trying to compile a console application in Borland Builder 4.0. Unfortunately I had erased the "#include <condefs.h> line", which was causing the compilation error E2293. Thanks my workmate and Google who have led me till this question!

Regards,
Adriano Caye.
0
 
LVL 2

Expert Comment

by:katlin924
ID: 28504989
I have a question similar to this topic. However it is more on linking TCL libraries.
If you can help me with this, it is greatly appreciated.

thienpnguyen
said:

If papi.lib is a static library that made by other compilers as VC++,  you can not link it with C++ Builder.I assume papi.lib is a import library of papi.dll.Note that, C++ Builder doesn't understand  the import library of VC++. Therefore, you needrebuilder the import library from dll. Borland provides the utility "implib" for that job.             implib -a papi  papi.dllThe above command will produce papi.lib that can work with C++ Builder.
This shows that the result of implib will work fine in C++ builder. Is it the same with impdef?

If so, is it possible that the libraries created can be used in Cygwin using G++ compiler?

Here's the step by step procedure.
1. tcl80jp binaries for windows are created using visual c++.
2. I created a library from tcl80jp.dll to tcl80.lib so that I can use it in borland c++.
command: implib -a tcl80jp.lib tcl80jp.dll
3. I also created a def file so that it can be used in borland c++.
command: impdef -a tcl80jp.def tcl80jp.dll
4. Both worked for borland c++.

And then a request came that I need to use GCC/G++ compiler in Cygwin.
1. Same with the previous procedure, I used the tcl80jp.dll and tcl80jp.def to create a (*.a) library. I used dlltool for this.

command: dlltool.exe --dllname tcl80jp.dll --input-def tcl80jp.def --output-lib libtcl8.0jp.a
2. It produced a libtcl8.0jp.a.
3. I compiled it in GCC/G++ but error occurs. I always tells me "undefined reference".


So now I am thinking that is it possible that the created libraries are not compatible with G++/GCC compiler?

You can also look at my thread:
How to inlcude TCL libraries when compiling in Cygwin?

Thank you so much for your help. This is bugging me for 2 months now. i hope you can give me some idea.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now