sf からダウンロードした i686-w64-mingw32 を使用して POCO ライブラリをコンパイルしています。ライブラリがコンパイルされ、libPoco*.a ファイルが作成されます (いくつかの警告が表示されます)。これらのファイルを使用したい場合 (たとえば、文字列を整数に変換する小さなサンプル プロジェクトで)、リンカーは次のようなエラーをスローします: ./Debug/main.o:main.cpp:(.text+0xab): undefined reference to ` imp __ZN4Poco12NumberParser5parseERKS'
奇妙なことに、TDM-MinGW-4.7.1 を使用して両側 (lib とテスト アプリ) のコンパイルを行うと、すべて問題ありません!
両方のコンパイルで「-march=i386;-m32」を設定しようとしましたが、うまくいきませんでした。テストアプリをビルドしようとしたときのリンカーのログは次のとおりです。
g++ -o ./Debug/testpoco @"testpoco.txt" -L. -Lc:/poco/lib/ -lPocoFoundationmtd -v
Using built-in specs.
COLLECT_GCC=g++
...
Target: i686-w64-mingw32
...
Thread model: win32
gcc version 4.8.1 (rev5, Built by MinGW-W64 project)
...
COLLECT_GCC_OPTIONS='-o' './Debug/testpoco.exe' '-L.' '-Lc:/poco/lib/' '-v' '-shared-libgcc' '-mtune=generic' '-march=i686'
...
./Debug/main.o:main.cpp:(.text+0xab): undefined reference to `_imp___ZN4Poco12NumberParser5parseERKSs'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/testpoco] Error 1
testpoco.mk:77: recipe for target 'Debug/testpoco' failed