Thread: .h & .lib

  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    3

    .h & .lib

    Hi, first of all i need to apologize if i asked some stupid question
    i'm new to C programming.

    ok then, i have a .lib and .h file with me
    the .lib and .h file (as far as i know) were suppose to be used for "kick" a cash drawer open.
    and i wanted to know how can i use it to create some "kick" program for it

    i really need some help for this and once again i apologize if this is a stupid question

  2. #2
    Time-Lord Victorious! The Doctor's Avatar
    Join Date
    Aug 2012
    Location
    Perth, Western Australia
    Posts
    50
    I am not familiar with .lib files, but a .h file should contain the declarations of certain functions. Use these functions in your program to achieve the result you need.

    perhaps the .lib file is the actual implementation of the .h file ( and it may be hidden to you).

    don't forget to #include the .h file in your code. Like this:

    Code:
    #include "file.h"
    
    /* Code goes here */
    Last edited by The Doctor; 05-20-2013 at 02:22 AM.
    Code:
    if (codeWorks( code) && !youCanDoSomethingBetter( code) )
    {
         beHappy();
    } else
    {
         fixCode( code);
    }

  3. #3
    Registered User
    Join Date
    May 2013
    Posts
    3
    Quote Originally Posted by The Doctor View Post
    I am not familiar with .lib files, but a .h file should contain the declarations of certain functions. Use these functions in your program to achieve the result you need.

    perhaps the .lib file is the actual implementation of the .h file ( and it may be hidden to you).

    don't forget to #include the .h file in your code. Like this:

    Code:
    #include "file.h"
    
    /* Code goes here */
    hi The Doctor, thanks for the reply
    i've tried to include the.h file in my code

    Code:
    #include "FECCashdrawerDll.h"
    and under the include command there's a red line which when highlighted shows "Error:cannot open source file"FECCashdrawerDll.h""

    i put the FECCashdrawerDll.h in the Header Files
    (FYI i'm using visual studio 2012)

    and when i checked the FECCashdrawerDll.h
    there's this code
    int __stdcall SetStatusMask(char *chModel, WORDS mask);
    where the "words" word was highlighted

  4. #4
    Lurker
    Join Date
    Dec 2004
    Posts
    296
    Lets back up a bit...

    Where did you find these files?

    Without meaning to be rude, don't you think that you maybe should focus on getting the basics down before doing whatever it is you are trying to do?

  5. #5
    Registered User
    Join Date
    May 2013
    Posts
    3
    Quote Originally Posted by Jimmy View Post
    Lets back up a bit...

    Where did you find these files?

    Without meaning to be rude, don't you think that you maybe should focus on getting the basics down before doing whatever it is you are trying to do?
    no problem mate, just like i said i'm still new at C programming i have a SQL, some C#, and java programming background
    but i haven't learn about connecting my codes to a hardware also
    i'm a total newbie at C that's why i'm asking for help

    i got the .h and .lib file from documentation package that i received from FEC
    and i'm trying to create a program to open a cash drawer
    and so far as i search at google i need to include the header file before my code

    i really need some guidance here, thank you

  6. #6
    Lurker
    Join Date
    Dec 2004
    Posts
    296
    Quote Originally Posted by Diarmund07 View Post
    no problem mate, just like i said i'm still new at C programming i have a SQL, some C#, and java programming background
    but i haven't learn about connecting my codes to a hardware also
    i'm a total newbie at C that's why i'm asking for help

    i got the .h and .lib file from documentation package that i received from FEC
    and i'm trying to create a program to open a cash drawer
    and so far as i search at google i need to include the header file before my code

    i really need some guidance here, thank you
    Well then. From what I can see you probably doesn't have the things that your library depends on installed. The library you want to use probably have some sort of installer, which installs everything you need in a correct way. I advice you to do it that way instead of grabbing a library and the corresponding include file and try to use it.

    You seem to be using Windows, and that is something I haven't used in say 15 years or so, so I'm not really sure how these things are done in Windows. I recommend you to google for your library and/or read the documentation to understand how to properly install it and use it with your compiler.

    Hope this helps.

  7. #7
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,876
    Is this the cash drawer you are using? http://dl.fecpos.com/CustomerService...anual_V1.0.pdf
    Fact - Beethoven wrote his first symphony in C

  8. #8
    Registered User
    Join Date
    Apr 2013
    Posts
    1,656
    Quote Originally Posted by Diarmund07 View Post
    "Error:cannot open source file"FECCashdrawerDll.h""
    You sure you have the name spelled correctly and is this .h file in the same directory as the source file, which should be the main directory of your project?

    As for the .lib file, try adding that to your project under the project menu: project ... add existing item, ... . This should cause the .lib file to be added to your build steps.

Popular pages Recent additions subscribe to a feed