-2

I have a problem, I have a few header.h files and one library.lib file and nothing more. Is it possible to execute functions from header files in new project?

Thanks for answers :)

Meskis
  • 21
  • 2
  • 1
    You need to research this problem on your own first. – Jonathon Reinhart Sep 23 '14 at 15:10
  • 4
    The functions aren't in the header file(s), the header file(s) just contain declarations telling the compiler that some functions exists somewhere else. The functions are, hopefully, in the library file. – Some programmer dude Sep 23 '14 at 15:13
  • 1
    Hi this is a very basic C and C++ feature. You need to link your lib with your .exe file and include the header where you need to use it. The header contains information for the compiler and user, such as which types and methods you have avaliable in the lib. The lib file contains the actual code. – Stígandr Sep 23 '14 at 15:13

1 Answers1

3

"Is it possible to execute functions from header files in new project?"

Yes it's possible. You'll need to put #include "xxx.h" statements, where you need the function declarations to call them, and finally link your executable with the .lib file.

πάντα ῥεῖ
  • 83,259
  • 13
  • 96
  • 175
  • Thanks for help, I included my .h files and linked the library and it seems should be ok, but now I faced with a new problem. In error list I see just one error: "error LNK1104: cannot open file 'mfc42.lib'". Looks like the third-party library that I have is compiled with a oldest VC version(VC6.0), I'm using VC2012. Is it possible to change compiler options or to do something else to avoid this error? – Meskis Oct 01 '14 at 08:36