Thread: Help w/C++ program.. thanks in advance.

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    121

    Unhappy Help w/C++ program.. thanks in advance.

    Hi guys,

    I'm trying to modify a basic database program to provide for deleting a record, and I'm stuck. I've narrowed the compiler errors down to a few, but can't seem to progress any further. Sorry for the attachments, but they are all for the same project. Any tips you could provide would be great. Upon compiling, I get the following errors:

    C:\Documents and Settings\Pbrooks4\Desktop\cpp files\Copy of database.cpp In member function `void Database<T>::remove(const T&) [with T = Personal]':

    125 C:\Documents and Settings\Pbrooks4\Desktop\cpp files\Copy of database.cpp instantiated from `void Database<T>::run() [with T = Personal]'

    138 C:\Documents and Settings\Pbrooks4\Desktop\cpp files\Copy of database.cpp instantiated from here (This one points to, in int main(), Database<Personal>().run(); )

    29 C:\Documents and Settings\Pbrooks4\Desktop\cpp files\Copy of database.cpp 'class Personal' has no member named 'writeNullToFile' (Most frustrating error, as I clearly defined writeNullToFile in Personal and Student... error occurs if I comment out Personal and run Student from Database).

    C:\Dev-Cpp\Projects\Makefile.win [Build Error] ["../../Documents and Settings/Pbrooks4/Desktop/cpp files/Copy of database.o"] Error 1

    Thanks again for your time!

    P.S. - I will attach the student header file in a separate post

  2. #2
    Registered User
    Join Date
    Jun 2006
    Posts
    121

    C++ program help, part 2

    Here is the student header file I was missing, due to the 5-attachment constraint. Thanks!

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    74
    Hmm... I'm alittle confused... why are all your files prefixed with "Copy of"?

    Did you make a copy of a set of files, rename them "Copy of", and then put them in the same directory as the originals or something?

    All your files are including "Personal.h" and "Student.h" but no such files exist under that name unless you have some originals stored in the same directory. In which case your program is using the originals and not your copies and might explain such an error as:

    29 C:\Documents and Settings\Pbrooks4\Desktop\cpp files\Copy of database.cpp 'class Personal' has no member named 'writeNullToFile' (Most frustrating error, as I clearly defined writeNullToFile in Personal and Student... error occurs if I comment out Personal and run Student from Database).
    Example code in your Database.cpp:
    Code:
    #include "personal.h"
    #include "student.h"
    Shouldn't these be:
    Code:
    #include "copy of personal.h"
    #include "copy of student.h"
    Err... maybe I'm way off.. its late here and I'm semi-out of it.
    Last edited by Kurisu33; 10-15-2006 at 01:28 AM.

  4. #4
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Tips for getting better help:

    1 find the problem(s) and their exact locations
    2 create a small example (capable of placing in a single attachment or even inlining in post), preferably representing a complete program
    3 ask your problem

    PS: some of us don't really have the time to wade through mounds and mounds of attachments.

    PPS: [2] can be easily done by removing all functions and code not related to the problems.

    At first glance, this seems to be a multiple-file-not-able-to-find-proper-declaration-silly-me-forgot-to-#include-all-the-right-files error.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  5. #5
    Registered User
    Join Date
    Jun 2006
    Posts
    121

    Got it, thanks!

    Yep, it was the 'copy of' names that got me, didn't even think about it, but now that I fixed that and a mismatched return type on a function, it at least compiles. I figured it was a 'silly me' kind of deal, as jafet points out, just needed another perspective on it. I've been without sleep trying to get this, and was not seeing it through fresh, sharp eyes. Thanks a ton, guys!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM