Thread: personal library

  1. #1
    Registered User
    Join Date
    May 2009

    personal library

    What's the best way to go about setting up a library of personal classes and functions in visual studio 08?

    Here's the way I've done it so far:
    1) Create a directory in my documents for these files.
    2) Show the path to this directory under the include paths under something like tools > options in vs.
    3) Now I don't have to copy the code or even link it manually when I start a new project.
    But what looks kind of ugly to me is this:
    Where my header file (in this case function prototypes) is str_manip.h and the implementation file is str_manip.cpp, I have to include BOTH in my program, i.e.

    #include "str_manip.h"
    #include "str_manip.cpp"
    I haven't seen an include with a .cpp file, so that at least puts a question mark on this procedure for me.

    What's the correct way of doing this?

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Portland, OR
    You need to create an actual library. COMPILE your library files and link them to produce a .lib or a .dll file. Then link against this when you want to use your library. You seem to understand Visual Studio well enough to figure it out with some experimentation.
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 08-05-2010, 09:06 AM
  2. What's an import library?
    By chiefmonkey in forum C++ Programming
    Replies: 1
    Last Post: 06-19-2009, 05:00 PM
  3. Property Set Library (PSL) - Announcement
    By vultur_gryphus in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 05-29-2008, 06:04 AM
  4. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 04:52 AM
  5. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM