- 最後登錄
- 2024-3-27
- 在線時間
- 0 小時
- 註冊時間
- 2015-9-8
- 閱讀權限
- 20
- 精華
- 0
- UID
- 15855326
- 帖子
- 278
- 積分
- 277 點
- 潛水值
- 8890 米
| 若有安裝色情守門員,可用無界、自由門等軟件瀏覽伊莉。或使用以下網址瀏覽伊莉: http://www.eyny.com:81/index.php 本帖最後由 weirdococo 於 2017-5-22 05:19 PM 編輯
還有很詭異的是,我嘗試要去編譯它是可以編譯的(在win10),過程如下:
- frank@LAPTOP-8R9HO8BI ~/d/tmp/shareLibTest
- $ g++ -v
- 使用內建 specs。
- COLLECT_GCC=g++
- COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/lto-wrapper.exe
- 目的:x86_64-pc-cygwin
- 配置為:/cygdrive/i/szsz/tmpp/gcc/gcc-5.4.0-1.x86_64/src/gcc-5.4.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-5.4.0-1.x86_64/src/gcc-5.4.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible
- 執行緒模型:posix
- gcc version 5.4.0 (GCC)
- frank@LAPTOP-8R9HO8BI ~/d/tmp/shareLibTest
- $ cat lib.cpp
- #include <cstdint>
- #include <vector>
- #include <algorithm>
- #include <numeric>
- namespace HigherOrderFunctions {
- uint64_t doubleMe ( uint64_t tmp ) {
- return tmp * 2;
- }
- //filter
- template < typename Collection, typename filterOperate >
- Collection filter( Collection collection, filterOperate operate ) {
- collection.erase( std::remove_if(collection.begin(), collection.end(), [operate]( typename Collection::value_type i ) { return !operate(i); } ),
- collection.end() );
- return collection;
- }
- //map
- template < typename Collection, typename mapOperate >
- Collection map( Collection collection, mapOperate operate ) {
- std::transform( collection.begin(), collection.end(), collection.begin(), operate );
- return collection;
- }
- //zip
- template < typename Collection, typename biOperate >
- Collection zip( Collection firstCollection, Collection secoundCollection, biOperate operate ) {
- std::transform( firstCollection.begin(), firstCollection.end(), secoundCollection.begin(), firstCollection.begin(), operate );
- return firstCollection;
- }
- }
- frank@LAPTOP-8R9HO8BI ~/d/tmp/shareLibTest
- $ g++ -fPIC --std=c++11 -c lib.cpp -o lib.so
- lib.cpp:1:0: 警告:-fPIC ignored for target (all code is position independent)
- #include <cstdint>
複製代碼
補充內容 (2017-5-22 05:11 PM):
正在嘗試如何用Dev C++寫出來,因為命令列工具(像是make git cmake)都是些過時的東西,業界都用些IDE不用這種過氣的工具(老師說的)
補充內容 (2017-5-22 05:12 PM):
雖然IDE比較難學,但還是值得的。
補充內容 (2017-5-22 05:14 PM):
只是好難用,像是Dev C++我還找不到C++11選項。... |
|