personal library

This is a discussion on personal library within the C++ Programming forums, part of the General Programming Boards category; What's the best way to go about setting up a library of personal classes and functions in visual studio 08? ...

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    242

    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.

    Code:
    #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
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    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.
    Code:
    //try
    //{
    	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, 10:06 AM
  2. What's an import library?
    By chiefmonkey in forum C++ Programming
    Replies: 1
    Last Post: 06-19-2009, 06:00 PM
  3. Property Set Library (PSL) - Announcement
    By vultur_gryphus in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 05-29-2008, 07:04 AM
  4. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 05:52 AM
  5. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 08:55 AM

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