在pragma中使用宏标记导致不正确的替换

时间:2012-03-13 09:57:31

标签: c++ visual-studio-2010 macros pragma

我试图将宏用于" pragma include_alias"在VS2010中,但是我得到了一个奇怪的编译警告,这意味着替换是不正确的。 这是代码:

18 #define RAPID_INCLUDES_PATH(MY_TARGET_HEADERS)  "C:\\thirdpart\\rapidxml-1.13\\" ##  #MY_TARGET_HEADERS  
19 #define TEST(empty) "C:\\thirdpart\\rapidxml-1.13\\rapidxml_print.hpp"

//WORKS
21 #pragma include_alias( "rapidxml.hpp",  "C:\\thirdpart\\rapidxml-1.13\\rapidxml.hpp"  )
22 #pragma include_alias( "rapidxml_print.hpp" , TEST(empty) )

//FAILS
23 #pragma include_alias( "rapidxml_utils.hpp" , RAPID_INCLUDES_PATH(rapidxml_utils.hpp) )
24 #pragma include_alias( "rapidxml_iterators.hpp" , RAPID_INCLUDES_PATH(rapidxml_iterators.hpp)   )


26 #include "rapidxml.hpp"
27 #include "rapidxml_iterators.hpp"
28 #include "rapidxml_print.hpp"
29 #include "rapidxml_utils.hpp"

错误消息:

1>  Touching "Debug\xml2.unsuccessfulbuild".
1>ClCompile:
1>  stdafx.cpp
1>d:\workspace\v10\xml2\xml2\stdafx.h(23): warning C4081: expected ')'; found 'string'
1>d:\workspace\v10\xml2\xml2\stdafx.h(24): warning C4081: expected ')'; found 'string'
1>d:\workspace\v10\xml2\xml2\stdafx.h(27): fatal error C1083: Cannot open include file: 'rapidxml_iterators.hpp': No such file or directory
1>
1>Build FAILED.
1>

似乎有一些误用宏 任何人都知道如何解决它?非常感谢。

0 个答案:

没有答案