Declaration

This is a discussion on Declaration within the Windows Programming forums, part of the Platform Specific Boards category; Hi to all, Could anybody help me please? How do I declare all variables and functions as public. I'm trying ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    3

    Declaration

    Hi to all,

    Could anybody help me please?

    How do I declare all variables and functions as public.
    I'm trying to build a .lib which is OK but when I try to
    use this library a get unresoved linker error like this.

    error LNK2001: unresolved external symbol _InitializeCoolSB@4

    Thanks

    forge

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    23
    Inside .lib file all functions and variables are treated normally same as ordinary or as if it is included in your program. Just make sure that you add your .lib file into your project and you also include its header file where your prototype of your functions are found.

    Example:
    if your .lib file contains function below,

    void display()
    {
    printf("Test");
    }

    make sure in your .h file you have:

    void display();

    Thats it. I hope it helps...
    If they can, why can't I...

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    3
    Alextrons,

    Thanks for quick and clear reply.
    I did all the same way as you describe
    and it works well with another lib file
    but I have problem with the mylib.lib file.
    which I created with ICC compiler.
    It is my very first attempt to create
    .lib file.

    OK I have something like this below code in the .lib file

    void display()
    {
    printf("Test");
    }

    Should the library look something like this?

    #define STRICT
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    ....
    //
    public: //?????????????????????????

    void display()
    {
    printf("Test");
    }

    public: //?????????????????????????

    BOOL Initializexxxx(HWND hwnd)
    {
    ...
    ...
    }


    or should I declare whole section as public???

    Thanks for any help.

    forge

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    23
    Sorry forge I have no Idea of using public inside .lib file. I'm using Borland C++ 4.5 and I have no idea also with ICC. Maybe somebody could help us.
    If they can, why can't I...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 02:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 07:13 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM

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