Thanks
--
Jakub Cermak
You probably did, but did you try a rebuild (in case this is a stale pch
file hanging around).
Regards, Ron AF Greve
http://www.InformationSuperHighway.eu
"Jakub Cermak" <Jakub...@discussions.microsoft.com> wrote in message
news:6D92F620-E3F4-4ED6...@microsoft.com...
To use precompiled headers you should have:
* A single file, typically named stdax.cpp that's compiled with /Yc (Create
PCH File). That .cpp file typically #includes only a single header file,
traditionally named stdafx.h.
* A single header file which defines or includes all of the common
definitions for your project. In practice, it's rarely worth putting
anything other than Windows or framework (MFC, ATL) headers and global
#defines in your precompiled header file. You should NOT put code in your
stdafx.h file (e.g. class or variable definitions)
* All other files must #include "stdafx.h" as (important here) The Very Fist
Non Comment Line In The File. All other files must be compiled with /Yu (use
PCH file).
Verify that you've satisfied the above requirements.
What exactly is in your stdafx.h file? Where is the file located relative
to the rest of the project?
-cd
#include "stdafx.h"
(2) I do have this one. Content of StdAfx.h:
#pragma once
#using <mscorlib.dll>
#include <iostream>
#define LEAN_AND_MEAN
#include <windows.h>
#include <vector>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <vector>
#include <map>
#include <string>
#include <vcclr.h>
#include <deque>
#include <sstream>
#include <stdio.h>
(3) I checked all .cpp files and all of them has the #include "stdafx.h" as
the first line.
And both stdafx.h and .cpp are located in the $(SolutionDir)/DaqCpp
My project root is $(SolutionDir)/Daq
Anything suspicious or causing problems?
--
Jakub Cermak
Maybe
#using <mscorlib.dll>
should come after
#include <windows.h>
--
David Wilkinson
Visual C++ MVP
I too would be suspicious of the #using. Since the error message refers to
a .NET/CLR function being called, I'd try moving the #using out of the PCH
file and see if that fixes it.
-cd
Carl:
Actually, what does this using directive do if the project is already compiled
with /clr ?
So many things puzzle me about how C++/CLI works ...
#using does something sort of equivalent to building a header file from the
assembly's meta data and then feeding that header to the compiler. Of
course, no header is actually generated - but that's the effect.
It's equivalent to the C# compiler's /reference command-line option or the
C++ compiler's /FU command line option.
-cd
"Carl Daniel [VC++ MVP]" wrote:
Thanks, Carl, but ...
I don't know much about C++/CLI, but I did work through the C++/CLI examples in
Ivor Horton's book (2005 version, but using VS2008).
In these sample solutions I do not see any #using directives in the source, but
do I see a bunch of /FU's on the command line, such as
/FU "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll"
However I do not see one for mscorlib.dll. Why is that?
It's built in to the compiler to always force a reference to mscorlib. Use
of #using is strictly optional - it's not unlike using #pragma
comment(lib...) to pull a library into the link without having it listed
explicitly in the linker inputs.
-cd
Thanks, Carl.
One little mystery cleared up. But many more remain ...