how to use a self-defined lib in VC6

This is a discussion on how to use a self-defined lib in VC6 within the C Programming forums, part of the General Programming Boards category; Hi,all I would like to use some functions from a 3rd moudule. And I have had it compiled into 2 ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    16

    how to use a self-defined lib in VC6

    Hi,all
    I would like to use some functions from a 3rd moudule.
    And I have had it compiled into 2 lib files.

    But , I now face such a problem.

    There are too many self-defined sub-functions and structs in the moudle. The arguments in the functions I will call are also self-defined and contain many levels of sub-structs.

    So I can not just add one head file in my project to define all these head files.

    What can I do ?

    Thanks.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I don't quite get your question. If you have a library you want in your program, include its header file and make sure the lib file is linked (Project -> Options... something).
    What do you mean by self-defined? If you left the declaration out of the header, then those functions can't be "found" by your program...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    16
    Originally posted by Magos
    I don't quite get your question. If you have a library you want in your program, include its header file and make sure the lib file is linked (Project -> Options... something).
    What do you mean by self-defined? If you left the declaration out of the header, then those functions can't be "found" by your program...
    Thanks for your answer.
    Let me say much more clear.
    I have got some source files which provides many functions helpful to my program.

    I think I have 2 choises:

    1, compile the source into lib files, and use the functions.
    But the result is in these functions, there are too many user-defined structures (defined by the source filesk authors), and it is very difficult for me to generate the head file including all the structures I will use.


    2, seperate the functions out into a dependent project, and compile the dependent project into lib file which I can use.
    But there is also the same program. The structures are too complicated that I can not seperate the functions out .

    For exmaple:

    typedef stA {
    objB b;
    ...

    } objA;

    objA *functionA(obj1 *aa...)
    {
    ...
    }

    and objB is defined in another head file.
    further more, there is objC in objB and objC is defined in 3rd head file......

    The head files are in different folders.



    Do you have any suggestion that I can call the functionA in my program?
    I am now doing it on the windows, and later I will do it on unix.
    Any suggestion is welcome.

    Thanks,

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    So if I got that correctly, there is not 1 header file for that library but alot of em. Well, first I'd have to say that's a bad structuration the maker of the library did. Every library shouldn't have more than one header file (if that header file includes other files is another thing ).

    I see no other solution than you make your own single-included header for that library. Try to compile, see what "undeclared identifer" you get then search for that header file and include it.

    The header you make could look something like this:
    Code:
    #ifndef _MYOWNHEADERFILE_
    #define _MYOWNHEADERFILE_
    
    #include "ObjA.h"
    #include "ObjB.h"
    #include "Subfolder1/Obj1.h"
    #include "Whatever.h"
    
    #endif
    Make sure you use the #ifndef / #define if you include the header in more than one file in your project.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Registered User
    Join Date
    Feb 2003
    Posts
    16
    Thank you.

    Do you mean I generate the head file to include all the files used in the library when I use the library ?


    let me try.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking problems in Visual Studio
    By h3ro in forum C++ Programming
    Replies: 5
    Last Post: 03-04-2008, 01:39 PM
  2. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. DLL compiling question
    By Noose in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2004, 06:16 AM
  5. Header files
    By borland_man in forum C++ Programming
    Replies: 14
    Last Post: 02-22-2002, 03:30 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21