【发布时间】:2015-05-21 09:04:42
【问题描述】:
我正在尝试将 Math.cpp 转换为 Cygwin 中的 dll。 我正在尝试在 Cygwin 中编译这段代码。
gcc -c Math.cpp
现在我正在尝试将 .o in 转换为 .dll。为此,我使用了以下代码
gcc -shared -o Math.dll Math.o
在 cygwin 中哪里收到一条巨大的错误消息,上面写着“Math.o:Math.cpp:(.text+0x55): undefined reference to std::ios_base::Init::Init()'
Math.o:Math.cpp:(.text+0x55): relocation truncated to fit: R_X86_64_PC32 against undefined symbolstd::ios_base::Init::Init()Math. o:Math.cpp:(.text$_ZN11Mathematics5inputEv[_ZN11Mathematics5inputEv]+0x21): 未定义引用`std::basic_ostream >& std::operator(std::basic_ostream >&, char const*)''"等等。
在我的 C++ 程序命名空间是 std; 类名是数学,有两个方法 input() 和 add() 并且有一个 main 方法调用这些方法。
【问题讨论】: