class http
{
public:
http();
http(string domain, string path);
};
//source http.cpp
#include "stdafx.h"
#include "http.h"
http::http() { }
http::http(string domain, string path):domain(domain), path(path),
bError(false)
{
}
bool http::getHP() { return true; }
//test program
#include <iostream>
#include "http.h"
#include "stdafx.h"
int main(void)
{
http x;
return 0;
}
If I comment out the http x; line everything compiles\links ok.
"Mr X online.no>" <laasunde@<remove> wrote in message
news:3e510ecb$1...@news.broadpark.no...
"Colin Girling" <colin.g...@virgin.net> wrote in message
news:lm84a.1227$uz6.1...@newsfep1-win.server.ntli.net...
You seem to be using MSVC++ compiler with pre-compiled headers on and the
pre-compiled header include file has its default name - 'stdafx.h'. In this case
everything that you put in your source file before the pre-compiled header
include directive (#include "stdafx.h") is ignored. That applies to '#include'
directives for 'iostream' and 'http.h'. That's what seems to be the reason for
the error. Rearrange these directives so that 'stdafx.h' is at the top.
If you have any additional questions about this feature of MSVC++ compiler, ask
them in a newsgroup dedicated to MSVC++.
--
Best regards,
Andrey Tarasevich
Brainbench C and C++ Programming MVP