mgrD Temat założony przez niniejszego użytkownika |
BigIntegerLibrary - instalacja » 2014-01-19 19:04:11 Witam, próbuję zainstalować tą biblioteke: https://mattmccutchen.net/bigint/ używając tego poradnika: http://cpp0x.pl/artykuly/?id=48 lecz mam nieco inne pliki i nie mogę sobie poradzić z tym. Uzywam oczywiście Code:Block. Błędy, jakie mam to: undefined reference to `BigInteger::BigInteger(int)'| undefined reference to `operator<<(std::ostream&, BigInteger const&)'| obj\Debug\main.o||In function `BigInteger::operator*(BigInteger const&) const':| \bigint\BigInteger.hh|156|undefined reference to `BigInteger::multiply(BigInteger const&, BigInteger const&)'| ||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|
#include <iostream> #include "BigIntegerLibrary.hh" #include <string>
int main() { BigInteger a = 65536; std::cout <<( a * a * a * a * a * a * a * a ); return 0; }
Proszę o pomoc bo od rana się z tym męczę. |
|
DejaVu |
» 2014-01-19 19:35:00 1. Utwórz projekt typu 'library'. 2. Dołącz do projektu pliki: 3. Skompiluj. 4. Masz gotową bibliotekę. 5. Bibliotekę gotową dodajesz do linkera w innym projekcie, w którym chcesz korzystać funkcjonalności z tej biblioteki (zakładam, że pliki *.hh wiesz gdzie wgrać i jak podać poprawną do nich ścieżkę). Opcja prostsza1. Utwórz projekt w którym rozwijasz swój program. 2. Wspomniane wcześniej pliki do projektu (pliki przekopiuj do tego samego katalogu co Twoje kody źródłowe) 3. Skompiluj i możesz się cieszyć funkcjonalnością tej biblioteki w swojej aplikacji. Opcja prostsza jest zła do większych projektów, ale na potrzeby edukacyjne będzie wystarczająca. |
|
mgrD Temat założony przez niniejszego użytkownika |
» 2014-01-19 20:06:07 Dalej to samo niestety, zastosowałem się do: Opcja prostsza 1. Utwórz projekt w którym rozwijasz swój program. 2. Wspomniane wcześniej pliki do projektu (pliki przekopiuj do tego samego katalogu co Twoje kody źródłowe) 3. Skompiluj i możesz się cieszyć funkcjonalnością tej biblioteki w swojej aplikacji. 1. Użyłem file -> new -> project -> console application: http://iv.pl/images/36636527670410730500.jpg2. Ctrl + c & ctrl + v do folderu, gdzie zapisałem projekt: http://iv.pl/images/13597475495984515199.jpg3. Włączyłem Code:Blocks po czym użyłem klawisza f9 i zoabczyłem to: Documents\test\BigUnsigned.hh|23|warning: access declarations are deprecated in favour of using-declarations; suggestion: add the 'using' keyword [-Wdeprecated]| Documents\test\BigUnsigned.hh|87|warning: access declarations are deprecated in favour of using-declarations; suggestion: add the 'using' keyword [-Wdeprecated]| Documents\test\BigUnsigned.hh|88|warning: access declarations are deprecated in favour of using-declarations; suggestion: add the 'using' keyword [-Wdeprecated]| Documents\test\BigUnsignedInABase.hh|103|warning: access declarations are deprecated in favour of using-declarations; suggestion: add the 'using' keyword [-Wdeprecated]| Documents\test\BigUnsignedInABase.hh|104|warning: access declarations are deprecated in favour of using-declarations; suggestion: add the 'using' keyword [-Wdeprecated]| obj\Debug\main.o||In function `main':| Documents\test\main.cpp|7|undefined reference to `BigInteger::BigInteger(int)'| Documents\test\main.cpp|8|undefined reference to `operator<<(std::ostream&, BigInteger const&)'| obj\Debug\main.o||In function `BigInteger::operator*(BigInteger const&) const':| Documents\test\BigInteger.hh|156|undefined reference to `BigInteger::multiply(BigInteger const&, BigInteger const&)'| ||=== Build finished: 3 errors, 5 warnings (0 minutes, 0 seconds) ===|
kod: #include <iostream> #include "BigIntegerLibrary.hh" #include <string>
int main() { BigInteger a = 65536; std::cout <<( a * a * a * a * a * a * a * a ); return 0; }
|
|
DejaVu |
» 2014-01-19 21:01:12 Nie dodałeś do projektu plików *.cc - wklejony log kompilacji mówi, że tylko skompilował się plik main.cpp. |
|
mgrD Temat założony przez niniejszego użytkownika |
» 2014-01-19 21:22:10 Nie wiem czy o to chodziło, lecz zrobiłem tak( new file -> file -> C/C++ source -> stworzyłem każdy plik z biblioteki i wkleiłem tam właściwą zawartość, ponieważ nie potrafiłem dodać gotowego pliku do projektu w C:B ~ w VS wiem jak to się robi): http://iv.pl/images/33030136260219747511.jpg@: Nie dodałem tylko plików zaznaczonych na screenie("sample.cc" i "testsuite.cc"). efekty: ||=== test, Debug ===| obj\Debug\main.o||In function `main':| \Documents\test\main.cpp|7|undefined reference to `BigInteger::BigInteger(int)'| \Documents\test\main.cpp|8|undefined reference to `operator<<(std::ostream&, BigInteger const&)'| obj\Debug\main.o||In function `BigInteger::operator*(BigInteger const&) const':| \Documents\test\BigInteger.hh|156|undefined reference to `BigInteger::multiply(BigInteger const&, BigInteger const&)'| ||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|
Paczka projektu: http://www.sendspace.com/file/78bml2kod: #include <iostream> #include <string> #include "BigIntegerLibrary.hh"
int main() { BigInteger a = 65536; std::cout <<( a * a * a * a * a * a * a * a ); return 0; }
Wybacz, lecz nie robiłem nigdy nic podobnego z Code:Blocks. |
|
Gabes |
» 2014-01-19 22:14:20 W panelu Management klikasz prawym klikiem na ikonkę projekt test, wybierasz Add files.. dodajesz pliki biblioteki, prócz dwóch testowych (sample2,testsuite2),dodajemy w ten sposób że przytrzymujemy klawisz Ctrl na klawiaturze i lewym klikiem w myszce na poszczególne pliki , otwórz i OK. Aby usnąć jakiś plik np. main klikasz w panelu na niego (prawy klik) i wybierasz z menu Remove file from project. Dodawanie Poszczególnych przykładów sample2 i testsuite2 to już wiesz prawym klikiem na ikonkę...
|
|
mgrD Temat założony przez niniejszego użytkownika |
» 2014-01-19 22:27:20 Dziękuje, działa :) |
|
« 1 » |