Results 1 to 7 of 7

Thread: Unresolved External Error

  1. #1

    Thread Starter
    Banned
    Join Date
    Jun 2002
    Posts
    40

    Unresolved External Error

    --------------------Configuration: Horses - Win32 Debug--------------------
    Linking...
    Horses.obj : error LNK2001: unresolved external symbol "void __cdecl dispStat(class ofstream,class ifstream,class apvector<int>)" (?dispStat@@YAXVofstream@@Vifstream@@V?$apvector@H@@@Z)
    Debug/Horses.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    Horses.exe - 2 error(s), 0 warning(s)
    ----------------------------------------------------------------------------------------

    It compiles but does not build

    #include "stdafx.h"
    #include <apvector.h>
    #include <fstream.h>


    void dataFile(ofstream write, ifstream read, apvector<int> stats);
    void dispStat(ofstream write, ifstream read, apvector<int> stats);

    void main()
    {
    ofstream write;
    ifstream read;
    apvector<int> stats;
    int choice;
    dataFile(write,read,stats);
    cout<<"< Menu > "<<endl<<endl;
    cout<<"1. Reset Horse Statistics"<<endl;
    cout<<"2. View Horse Statistics"<<endl;
    cout<<"3. Hit the track"<<endl<<endl;
    cout<<"\t. ";
    cin>>choice;
    switch (choice)
    {
    case 1 : break;
    case 2 : dispStat(write,read,stats);
    case 3 : break;
    default : cout<<endl<<endl<<"\t.Please enter a correct choice."<<endl<<endl;
    }

    dispStat(write,read,stats);
    }

    void dataFile(ofstream write, ifstream read, apvector<int> stats)
    {
    read.open("stats.dat");
    read>>stats[0];
    read.close();
    if (stats[0]==0)
    {
    write.open("stats.dat");
    for (int x=0;x<8;x++)
    write<<"0 ";
    write.close();
    }
    }

    void dispStats(ofstream write, ifstream read, apvector<int> stats)
    {
    read.open("stats.dat");
    for (int x=0;x<stats.length()-1;x++)
    {
    stats.resize(stats.length()+1);
    read>>stats[x];
    }
    read.close();
    for (x=0;x<stats.length()-1;x++)
    cout<<stats[x]<<" ";
    }
    Last edited by C Penis Plus; Jun 22nd, 2002 at 03:47 AM.

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    add apvector.h to the project...and leave #include<apvector.h>


  3. #3

    Thread Starter
    Banned
    Join Date
    Jun 2002
    Posts
    40
    What do you mean "add" it to the project, and how would I do that? Thanks.

  4. #4
    Hyperactive Member Knowledge_is_Et's Avatar
    Join Date
    Dec 2001
    Location
    An Oak.
    Posts
    305
    I believe he means to add it to the program as you would a .cpp file.
    Now returning to the world of VB. Please make sure your seatbelts are securely fastened and all trays are in their upright and locked position.

  5. #5

    Thread Starter
    Banned
    Join Date
    Jun 2002
    Posts
    40
    Yeah I added it, but I still get the error.

  6. #6
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    same one?


    by the way: just in case. if you're using VC++, adding to a project: menu: Project > Add To Project > Files (apvector.h is in the include folder)

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Spelling error: your prototype says appStat, the function is called appStats!
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width