Separate Compilation

Hi,

I am using the IDE Dev-C++ and I don't have a clue about how to compile a little program written in different source files...

for example I created these three simple files:

- Operations.h

#ifndef _OPERATIONS_
#define _OPERATIONS_

int addition (int, int);
int subtraction (int, int);

#endif // _OPERATIONS_


- operationsSource.cpp

#include "Operations.h"

int addition (int a, int b) {
return a+b; }

int subtraction (int a, int b) {
return a-b; }


- main.cpp
#include <iostream>
#include "Operations.h"

int main() {
int x1(11), x2(22);
int s = addition(x1,x2);
cout << s << endl;
return 0; }


I understand that I should not compile Operations.h, compile operationsSource.cpp first and finally compile main.cpp...
But when I click on Compile from the file operationsSource.cpp I get the following error:
[linker error] undefined reference to 'WinMain@16'
Id returned 1 exit status

What is probably going on is that the compiler is expecting a main function in the file operationsSource.cpp
I know how to do these things using g++ in linux, but I really cannot figure out how to get them right with Dev-C++ on Windows

Any help is really appreciated since most books when dealing with such things just say: "this depends on your compiler.."

Thank you very much
pls...
Topic archived. No new replies allowed.