Re: Error in compliling AODB _ConnectionPtr
From: Bruce Stemplewski (Bruce.Stemplewski_at_nospamstempsoft.com)
Date: 03/24/04
- Next message: Alexander Nickolov: "Re: Debug Assertion in CWindowImplBaseT. Exception in Relese build [PSC]"
- Previous message: Anthony Munter: "Re: Debug Assertion in CWindowImplBaseT. Exception in Relese build [PSC]"
- In reply to: Alexander Nickolov: "Re: Error in compliling AODB _ConnectionPtr"
- Next in thread: Igor Tandetnik: "Re: Error in compliling AODB _ConnectionPtr"
- Reply: Igor Tandetnik: "Re: Error in compliling AODB _ConnectionPtr"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 23 Mar 2004 19:20:38 -0500
Thanks for the explanation but I had already changed my code:
// Test.cpp : Defines the entry point for the console application.
//
#include <ole2.h>
#include <stdio.h>
#include <conio.h>
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace
rename("EOF", "EndOfFile")
#include "stdafx.h"
int main(int argc, char* argv[])
{
_ConnectionPtr pConnection = NULL;
return 0;
}
and I still get a
error C2065: '_ConnectionPtr' : undeclared identifier
Any ideas?
"Alexander Nickolov" <agnickolov@mvps.org> wrote in message
news:Okop%233REEHA.548@TK2MSFTNGP10.phx.gbl...
It's very simple actually. The compiler ignores ALL input
before the #include file for hte precompiled header,
because it may affect the definitions in that header.
Conditional compilation should be a familiar concept
for any C and C++ developer. Since the precompiled
header (as it name says) is not compiled at this point,
the compiler cannot afford conflicting declarations
between what the header contains and what the subsequent
code may think. Hence the rule. Only put comments
before the precompiled header line.
-- ===================================== Alexander Nickolov Microsoft MVP [VC], MCSD email: agnickolov@mvps.org MVP VC FAQ: http://www.mvps.org/vcfaq ===================================== "Kim Gräsman" <kim@mvps.org> wrote in message news:OTdnNcQEEHA.1272@TK2MSFTNGP11.phx.gbl... > Bruce, > > > Can you get it to compile? > > Sure, you just need to include stdafx.h first of all, before including or > importing anything else - I should have been clearer on that in my previous > reply. > Now, I patiently await Alexander's explanation of how it works, and why the > position of #include "stdafx.h" is important... :) > > Hope that helps, > Kim > > > -----Original Message----- > > From: Bruce E. Stemplewski > > Sent: den 23 mars 2004 01:10 > > To: Kim Gräsman > > Subject: Re: Error in compliling AODB _ConnectionPtr > > > > Sorry for not mentioning the version of C++. I deserve 30 lashes :) > > > > I am using VC6 > > > > I changed the code as follows and still get the complie error: > > > > // Test.cpp : Defines the entry point for the console application. > > // > > #include <ole2.h> > > #include <stdio.h> > > #include <conio.h> > > > > #import "C:\Program Files\Common > > Files\System\ado\msado15.dll" no_namespace > > rename("EOF", "EndOfFile") > > > > > > #include "stdafx.h" > > > > int main(int argc, char* argv[]) > > { > > _ConnectionPtr pConnection = NULL; > > return 0; > > } > > > > It is interesting that the complier does not complain if the > > import path is > > wrong. I had it wrong at first anf the complier never complained. > > > > Can you get it to compile? > >
- Next message: Alexander Nickolov: "Re: Debug Assertion in CWindowImplBaseT. Exception in Relese build [PSC]"
- Previous message: Anthony Munter: "Re: Debug Assertion in CWindowImplBaseT. Exception in Relese build [PSC]"
- In reply to: Alexander Nickolov: "Re: Error in compliling AODB _ConnectionPtr"
- Next in thread: Igor Tandetnik: "Re: Error in compliling AODB _ConnectionPtr"
- Reply: Igor Tandetnik: "Re: Error in compliling AODB _ConnectionPtr"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|