Có thể thấy rõ trong quá trình liên kết (linkage) này là do trình biên dịch không tìm được definition tương ứng cho các thư viện của iostream của sltport. Bạn cần phải đảm bảo là bộ thư viện này của stlport đã được biên dịch đầy đủ. Một chú ý trong quá trình cài đặt stlport là bạn cần phải lựa chọn có hay không có stlport iostream implementation. (sử dụng thư viện stlport iostream hay ko) Bạn có thể sẽ phải config lại trong file config.Nguyên bản được gửi bởi ilovecplusplus
Mình copy một đoạn trong file install để giúp cho việc biên dịch lại thư viện này.
==== Building STLport iostreams library ==========
Below are step-by-step instructions to build STLport streams library:
5) Using appropriate makefile, do "make clean all" to build the STLport libraries
(makefiles are set up to build several different flavors - debug/nondebug,
static/dynamic versions).
Optionally, do "make install" to copy STLport headers and libraries to shared location.
Note : your "make" program may have different name, like "nmake" for Visual C++.
Examples :
1. If you are building STLport for just one compiler, you may do something like that
(DOS syntax for Visual C++ below):
copy vc6.mak makefile
nmake clean all
nmake install
2. If you plan to build STLport with multiple compilers, use "make -f" :
make -f gcc.mak clean install
make -f sunpro.mak clean install
This will build and install STLport for gcc & SUN CC.
"install" target works on most platforms.
On Win32, it does the following :
- copies STLport headers in "stlport" subdirectory of your compiler's INCLUDE directory;
- copies STLport .lib files in your compiler's LIB directory;
- copies STLport DLLs to Windows system directory so they can be found at runtime.
On UNIX, it does the following :
- copies STLport headers in "stlport" subdirectory of system's local include directory (default is /usr/local/include);
- copies STLport .a and .so files to system local library directory (default is /usr/local/lib);
6) If build fails, you may choose to :
- try fixing the build ;
- wait until somebody else will submit corresponding changes to be incorporated in next STLport
release/snapshot. To use STLport w/o its own iostreams, please do step 3a).
In case you do patch STLport, please submit your patches to support@stlport.com or (better)
to STLport Forum (http://www.stlport.com/cgi-bin/forum/dcboard.cgi)
7) Do "make install" to install resulting libraries into "./lib" subdirectory.
==== Linking your application with STLport library ==========
8) Supply the "lib" subdirectory to the library search path and add desired
library to the list of libraries to link with.
Examples (imagine you have mytest.cpp in the same directory as this file is):
With gcc : gcc -I./stlport mytest.cpp -L./lib/ -lstlport_gcc
With DEC CC : cxx -I./stlport mytest.cpp -L./lib/ -lstlport_deccxx
With SUN CC : CC -I./stlport mytest.cpp -L./lib/ -lstlport_sunpro
.....
[ Visual C++ specific ] For VC++, you do not have to specify "stlport-msvc-XXX.lib" explicitly,
as it is being choosen and forced to link automatically by "#pragma"'s in stlport/config/stl_select_lib.h.
Appropriate version is being selected based on /MD[d] vs /MT[d] options and __STL_DEBUG setting.
All you have to do is to set library search path for the linker.
Example :
cl.exe /I.\stlport mytest.cpp /link /libpath:.\lib /MD
9) If you linked your application with shared STLport library (.so or .dll), please make your .so or
.dll's to be found in PATH at runtime. On Windows, the simplest way to do it
is to copy all .dll's to Windows system directory. Or, you might choose to add directory
containing STLport to the PATH environment string.
10) Have fun !