Quote Originally Posted by nikosft View Post
People for www.oversim.org



Sorry it did not work. Here is the example code
Well, here is example code that proves to you what I stated does work.

MyHeader.h
Code:
#ifndef MYHEADER_H
#define MYHEADER_H

int func1();

int func1()
{
    return 0;
}
#endif
Module1.cpp
Code:
#include <iostream>

int func1();  // function is declared

void foo()
{
    std::cout << func1();
}
main.cpp
Code:
#include "MyHeader.h"

void foo();

int main()
{
    func1();  // call the function to show main() can call it.
    foo();  // call the foo function
}
You have two modules. The main.cpp is the only one that actually includes the myheader.h file. The module1.cpp just declares the function and does not directly include it.

Basically all a header file gives you is a convenient way to declare functions and define constants. It is just that for some odd reason, the people you got that inet.h header from has a function body in the header. So the way out of this is simple -- just don't include that header and declare the functions yourself (given that you know the correct declaration).

Regards,

Paul McKenzie