更新:在roapi.h中添加了RoInitialize的样子
我正在编写纯C++ 11 WinRT库.我不使用WRL或C++/CX(显然,如果我想要纯C++ 11).
我得到了我的代码来编译和运行MSVC,但我想看看我是否可以在Mingw Gcc上编译和运行代码.具体来说,我使用的是从nuwen.net获得的Gcc 4.7.2.
此时我需要的是一种调用Windows API函数RoInitialize RoUnitialize RoGetActivationFactory和HSTRING函数WindowsCreateString,WindowsDuplicateString,WindowsDeleteString的方法.
我尝试用G ++编译这个程序,但得到了错误
extern "C"{
__declspec(dllimport)int __stdcall RoInitialize(int);
}
int main(){
RoInitialize(1);
}
Run Code Online (Sandbox Code Playgroud)
我试着编译,但得到了
c:\Users\jrb\Desktop>g++ gccwinrt.cpp
C:\Users\jrb\AppData\Local\Temp\ccy7y1V9.o:gccwinrt.cpp:(.text+0x1e): undefined
reference to `_imp__RoInitialize@4'
collect2.exe: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
如果有人能指出我正确的方向如何声明这些功能以及我需要链接到哪些库,我将不胜感激.即使它需要LoadLibrary/GetProcAddress,我仍然可以使用它
更新:这是RoInitialize在标题roapi.h中的样子
ROAPI
_Check_return_
HRESULT
WINAPI
RoInitialize(
_In_ RO_INIT_TYPE initType
);
ROAPI is just a define for __declspec(dllimport)
_Check_return_ is part of SAL (Secure Annotations Language?)
HRESULT maps to int32
WINAPI is a define for __stdcall
RO_INIT_TYPE is an enumeration so …Run Code Online (Sandbox Code Playgroud) 我有一个函数,它在一个名为的命名空间中实现并记录implementation.我有另一个命名空间useful,我用它using来公开该函数.我不想记录implementation命名空间.我想要在useful命名空间下记录该功能.我正在寻找一种在doxygen中执行此操作的简单方法.
下面是一个我想要useful_function文档的简单示例namespace useful.现在,它是在namespace implementation.
/// \file test.cpp
/// \brief This is a brief description.
///
///
/// This is a longer description
namespace implementation{
/// This is a useful function
void useful_function(){}
}
namespace useful{
using implementation::useful_function;
}
/// \namespace useful
/// This is a namespace that has useful functions
int main(int argc, char** argv){
useful::useful_function();
}
Run Code Online (Sandbox Code Playgroud)