0
#include <iostream>
#include "add.h"
#include "sub.h"
#include "Mult.h"
#include "div.h"
#include "mod.h"

using namespace std;


int main() {
  int a,b;
  cout << "Enter a number: ";
  cin >> a >> b;


add(a,b);
sub(a,b);
Mult(a,b);
div(a,b);
mod(a,b); 
  return 0;
}

#include "add.h"
#include <iostream>

using namespace std;

void add(int a, int b) 
{ 
    cout << "Addition value = " << a + b << endl; 
} 
#ifndef add_include
#define add_include



void add(int , int ); 



#endif

i am using dev-c++ when i wrote the program the fist time it worked then i saved it and closed and tried running the program second time it give this main.cppy9.cpp:(.text+0x4b): undefined reference to add(int, int)' main.cppy9.cpp:(.text+0x58): undefined reference tosub(int, int)' main.cppy9.cpp:(.text+0x65): undefined reference to Mult(int, int)' main.cppy9.cpp:(.text+0x72): undefined reference todiv(int, int)' main.cppy9.cpp:(.text+0x7f): undefined reference to `mod(int, int)'

    C:\crossdev\src\mingw-w64-v3-git\mingw-w64-crt\crt\crt0_c.c undefined reference to `WinMain'
Abood 4433
  • 19
  • 5
  • You need to compile all you cpp files together. That would look like `g++ main.cpp add.cpp div.pp ...(rest of cpp file)` – NathanOliver Feb 28 '20 at 14:15
  • You must configure your IDE to compiler and link all `.cpp` files. – walnut Feb 28 '20 at 14:15
  • You say it worked one time, so try to clear the build artefacts and make a clean build. And think about using a halfway modern IDE and/or compiler. – Lukas-T Feb 28 '20 at 14:15

0 Answers0