2010-04-05 55 views
1

我想接下来的结构问题的的#ifndef和#pragma一次

stdafx.h中写程序 - 包含程序常量和头的#include部分的#define defenitions至极使用中的所有项目。

frmMain.h - Form1的contatins代码也可以显示form2并使用BckHeadr.h中的一些代码,一些函数调用stdafx.h中包含的头文件。

frmIniPrgs.h - 包含Form2的代码并使用BckHeadr.h中的一些代码,并且某些函数调用stdafx.h中包含的头文件。

BckHeadr.h - 包含函数的一些定义,一些函数调用stdafx.h中包含的头文件。

我知道我必须使用#ifndef或#pragma once指令。但我不能决定这个问题。我包含在stdafx.h中:frmIniPrgs.H,BckHeadr.h,frmMain.h。并在所有模块中使用#ifndef。我USET这样的:

#ifndef MYMODULE_H 
#define MYMODULE_H 
//module code 
#endif 

有在我的项目旁边的错误(我有俄罗斯的Visual Studio和错误的文本是由谷歌翻译翻译并可能包含错误,ScnIniPackages是我在BckHeadr.h功能) :

BckHeadr.h (96): error C3861: PtrToStringChars: identifier not found 
BckHeadr.h (141): error C2065: vector: undeclared identifier 
BckHeadr.h (141): error C2062: type "int" is not required 
BckHeadr.h (141): error C2143: syntax error: no ";" before "(" 
BckHeadr.h (141): error C2447: (: missing function header (possibly using a formal list of old type) 
BckHeadr.h (169): error C2065: vector: undeclared identifier 
frmIniPrgs.h (119): error C2065: vector: undeclared identifier 
frmIniPrgs.h (122): error C3861: ScnIniPackages: identifier not found 
frmIniPrgs.h (121): error C2065: vector: undeclared identifier 
C: \ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ include \ Wininet.h (381): error C2872: FILETIME: ambiguous symbol 
    be 'C: \ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ include \ windef.h (377): _FILETIME FILETIME' 
    or 'c: \ windows \ microsoft.net \ framework \ v2.0.50727 \ mscorlib.dll: System:: Runtime:: InteropServices:: FILETIME' 
+1

您使用的 “连接” 标签;你遇到编译器错误或链接器错误? – 2010-04-05 03:48:58

+0

我有很多编译器错误 – Xaver 2010-04-05 04:01:11

+2

如果你向我们展示了它们,我们可能会帮助你。 – GManNickG 2010-04-05 04:03:13

回答

1

尝试

#include <vector> 
using namespace std; 

这样可以解决一些错误(如果不是全部)。

1

您必须包含正确的STL标头。

#include <vector> 

你也可以添加一个命名空间

using namespace std; 

或者使用STL类为

std::vector<>