Linker error with win16? ive looked on internet nothing worked.

This is a discussion on Linker error with win16? ive looked on internet nothing worked. within the C++ Programming forums, part of the General Programming Boards category; Im having some trouble working these 3 files, When i go to compile the files they compile but i run ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    114

    Post Linker error with win16? ive looked on internet nothing worked.

    Im having some trouble working these 3 files, When i go to compile the files they compile but i run the program and it crashes. When i save Damage.h as a cpp it gives linker win16 error i did it just to see if would create errors well finding out ways to fix it.
    Im not sure wat is rong on the internet it said for a different series of code to add a empty main i did but that just makes multiple definitions. My goal is to fix this so it runs :P. I couldnt find any syntax errors.


    Damage Function. << Damage.h
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    
    int Damage(int param1, int param2){
          srand(time(NULL));
          int Maxdamage = param2;
          int Mindamage = param1;
          int random =rand() % Maxdamage + Mindamage ;
          return(random);
          }
    Main function. << Main.cpp
    Code:
    #include<iostream>
    #include "Weapon.h"
    #include "Damage.h"
    int main(){
        weapon sword1;
        sword1.maxdamage = 12;
        sword1.mindamage = 1;
        int damage = Damage(sword1.maxdamage,sword1.mindamage);
        std::cout << damage;
        system("PAUSE");
        return 0;
    }
    Weapon class. << Weapon.h
    Code:
    #ifndef WEAPON_H
    #define WEAPON_H
    class weapon
    {
          public:
                 int maxdamage;
                 int mindamage;
    };
    #endif
    Nvm i ____think______ i fixed it
    Last edited by Nathan the noob; 02-21-2009 at 05:24 PM.
    Who needs a signature?

  2. #2
    Registered User
    Join Date
    Jun 2008
    Posts
    114
    i fixed it , New problem why is the output always 12 it was seeded on the function that performs the eqaution.
    Last edited by Nathan the noob; 02-21-2009 at 05:29 PM.
    Who needs a signature?

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Because you passed in your parameters to the constructor backwards?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Internet Problems
    By SirCrono6 in forum Tech Board
    Replies: 3
    Last Post: 04-26-2004, 09:47 PM

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