AP Classes, won't work! Anyone familiar?

This is a discussion on AP Classes, won't work! Anyone familiar? within the C++ Programming forums, part of the General Programming Boards category; For the longest time I've been trying to get the AP classes to work with Visual C++ 6.0, but I ...

  1. #1
    Unregistered
    Guest

    AP Classes, won't work! Anyone familiar?

    For the longest time I've been trying to get the AP classes to work with Visual C++ 6.0, but I can't. Anyway, I used some installer to put them in the right directory and such, and it worked...I think. The compiler finds the ap classes, but I can't really use them. Here's a little example along with the error message I was slapped down with.


    #include <iostream.h>
    #include <apstring.h>

    void main ()
    {
    apstring thiswontwork("I will never be displayed");
    cout << thiswontwork;
    }



    --------------------Configuration: APJunk2 - Win32 Debug--------------------
    Compiling...
    source.cpp
    Linking...
    source.obj : error LNK2001: unresolved external symbol "public: __thiscall apstring::~apstring(void)" (??1apstring@@QAE@XZ)
    source.obj : error LNK2001: unresolved external symbol "class ostream & __cdecl operator<<(class ostream &,class apstring const &)" (??6@YAAAVostream@@AAV0@ABVapstring@@@Z)
    source.obj : error LNK2001: unresolved external symbol "public: __thiscall apstring::apstring(char const *)" (??0apstring@@QAE@PBD@Z)
    Debug/APJunk2.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.

    APJunk2.exe - 4 error(s), 0 warning(s)

  2. #2
    Registered User xlnk's Avatar
    Join Date
    Mar 2002
    Posts
    186
    apstring is assigned differently then string.

    Code:
    apstring thiswontwork = "I will never be displayed";
    and if you still get some errors, go ahead and include this:

    #include <apstring.cpp>

    also, depends.
    the best things in life are simple.

  3. #3
    Seņor Member
    Join Date
    Jan 2002
    Posts
    561
    That's weird, because I use the AP classes on VC++, Dev C++4, and Turbo C++ 4.5 and 3.0, and the classes work fine on all of them.

  4. #4
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Add apstring.cpp to the project, or include it like above.. those should fix the problems.

    Perhaps the compilation, linking, and loading process should be taught before students actually delve into code.. so they understand what compiler error messages like "undefined reference" mean.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. classes in windows programming
    By Struja in forum Windows Programming
    Replies: 3
    Last Post: 07-08-2008, 01:55 PM
  2. How properly inherit from template?
    By 6tr6tr in forum C++ Programming
    Replies: 118
    Last Post: 04-25-2008, 04:30 AM
  3. My monitor doesn't work with Ubuntu Linux.
    By indigo0086 in forum Tech Board
    Replies: 1
    Last Post: 07-12-2007, 10:59 AM
  4. copy array of classes or explicity call constructor
    By Doodle77 in forum C++ Programming
    Replies: 5
    Last Post: 06-10-2007, 11:57 AM
  5. Do I need Classes ?
    By jjj93421 in forum Game Programming
    Replies: 3
    Last Post: 04-24-2004, 09:19 AM

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