VC++ and library questions

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • VC++ and library questions

      Say I have created my own library of functions, and their cpp and .h files are all stored within this directory

      programming/library

      Now, I have want to start a project in this directory:

      programming/game

      How do I include all the .cpp and .h from my library directory without copying all the files over? (I'm using VC++ 6.0) Do I just add them to my projects? What about the .H files?

      Thanks in advance.
      Act in haste and repent at leisure.
      Code too soon and debug forever.
    • You can add them from where they are, but you have to remember that when you include your library header files in a source file that's in your project directory, you're going to more than likely specify the path to that header file. There are some work arounds to this though without having to copy and paste source files. You can add the files to your project, then go to your Project Settings, C++ tab, Preprocessor in the Categories List. Then in the Additional Include Directories, add the path to the folder containing your libary's header files. That way instead of doing:

      Source Code

      1. #include "path/to/library/libheader.h"

      you can do this:

      Source Code

      1. #include "libheader.h"

      If you want, you can also set up an environment variable that holds the path to your libary's source and just reference the environment variable in your Additional Include Directories field, check out this link on MSDN for more details on how to do this with VC++6.

      The post was edited 1 time, last by MRom ().