Официальный сайт студ.городка НГТУ
Программирование и БД » [C++] SGI или STLPort STL+Borland C++ 

#1  12.05.06 13:24

[C++] SGI или STLPort STL+Borland C++

как прикуртить реализацию STL от SGI или STLPort к Builder C++ 6.0 ?
Хочется поиспользовать hash_map. Кто в курсе как это сделать?

Offline

#2  12.05.06 13:53

Re: [C++] SGI или STLPort STL+Borland C++

если там исходники то пробуй их просто инклудить

Offline

#3  12.05.06 14:19

Re: [C++] SGI или STLPort STL+Borland C++

пробовал
материться на специализацию шаблона
блин патчей правда нет у меня на CBorland
не могу найти в варианте архива zip, везде exe-шники, тут просто на работе прокси не даёт exe качать

Offline

#4  12.05.06 15:11

Re: [C++] SGI или STLPort STL+Borland C++

reach написал(а):

материться на специализацию шаблона

а в чем выражаеться специализация шаблона?, а нет порта библиотеки под билдер

Offline

#5  12.05.06 15:57

Re: [C++] SGI или STLPort STL+Borland C++

возможно я неправильно выразился конечно :-)
вообщем вот фрагмент

/* helper class for finding non-const version of a type. Need to have
   something to assign to etc. when testing constant iterators. */

template <class _Tp>
struct _Mutable_trait {
  typedef _Tp _Type;
};
template <class _Tp>
struct _Mutable_trait<const _Tp> { //В ЭТОМ МЕСТЕ ОШИБКА
  typedef _Tp _Type;
};

В указанной строке вот такая ошибка
[C++ Error] concept_checks.h(237): E2238 Multiple declaration for '_Mutable_trait<_Tp>'

Offline

#6  12.05.06 16:13

Re: [C++] SGI или STLPort STL+Borland C++

вообщето это повторное объявление структуры _Mutable_trait
эти шаблоны лежат в одном файле?

Offline

#7  12.05.06 16:16

Re: [C++] SGI или STLPort STL+Borland C++

да это в одном и том же файле
файл этот как раз из библиотеки шаблонов от SGI

Offline

#8  12.05.06 16:23

Re: [C++] SGI или STLPort STL+Borland C++

сдаётся мне что что то не ладно в порядке подключения

How do I install the SGI STL?
You should unpack the STL include files in a new directory, and then use the -I (or /I) option to direct the compiler to look there first. We don't recommend overwriting the vendor's include files.

вот ответ из доков с SGI о том как подключить их библиотеки, в борланде я так понимаю нужно это сделать в настройках проекта, я так и сделал, но потом он начинает на другое ругаться

template <class _CharT, __DFL_TMPL_PARAM( _Traits , char_traits<_CharT>),
          __DFL_TMPL_PARAM(_Allocator , allocator<_CharT>) >
class basic_stringbuf;

[C++ Error] _iosfwd.h(45): E2041 Incorrect use of default

Offline

#9  12.05.06 16:37

Re: [C++] SGI или STLPort STL+Borland C++

в общем что я могу сказать про библиотеки и компиляторы, в моей практике мне не удалось подключить ни одну стороннюю бибилиотеку не предназначенную именно для определенного компилятора, так как реализации си++ у всех свои и стандартов до конца никто не придерживаеться, посмотри  в документации можно ли вообще оную библиотеку к борланду прикрутить?

Offline

#10  12.05.06 16:46

Re: [C++] SGI или STLPort STL+Borland C++

Спасибо посмотрю. Вроде на STLport вроде как есть, что то про то, что их реализацию к Borland компилятору прицепить можно, но это у меня тоже не получилось :-)

Offline

#11  12.05.06 17:10

Re: [C++] SGI или STLPort STL+Borland C++

otaku написал(а):

так как реализации си++ у всех свои и стандартов до конца никто не придерживаеться

Чего??? Какая своя реализация. Стандарт C++ никак не зависит от среды разработки. И его придерживаются если хотят чтобы средством разработки пользовались. И если библиотеки не подключаются - это как правило кривые руки разработчика пытающегося использовать их.
И то что ни одна стороняя библиотека не подключалась - это фигово )) Ибо на своем опыте знаю - частенько приходится в проектах исспользовать кучи сторонних библиотек )

И библиотеки к слову пишут не для какого то компилятора, как вы выразились, а просто на стандарте языка плюс с использованием возможно других библиотек )

Offline

#12  12.05.06 17:34

Re: [C++] SGI или STLPort STL+Borland C++

Чё так нервничать то? Если знаешь как прицепить - так уж лучше помоги :)
Кстати к слову сказать, стандарт то стандартом, а вот даже в 6-ом Borland до сих пор ключевое слово extern при работе с шаблонами не реализовано. У них так и написано что зарезервировано, но не реализовано (гады).

Исправлено reach (12.05.06 17:36)

Offline

#13  12.05.06 17:38

Re: [C++] SGI или STLPort STL+Borland C++

MadSlayer написал(а):

Чего??? Какая своя реализация. Стандарт C++ никак не зависит от среды разработки. И его придерживаются если хотят чтобы средством разработки пользовались. И если библиотеки не подключаются - это как правило кривые руки разработчика пытающегося использовать их.

особенно меня радовала переносимость кода с борланда в визуалстудию, и обратно, стандарты прям аж некуда деваться, вот хотел я заюзать бибилиотеку для дев си++, а в доках написано что она подключаеться тока к визуалси++, хорошо порт под дев нашел!

Offline

#14  15.05.06 00:59

Re: [C++] SGI или STLPort STL+Borland C++

А пример библиотеки можно? )

Offline

#15  15.05.06 08:41

Re: [C++] SGI или STLPort STL+Borland C++

MadSlayer написал(а):

А пример библиотеки можно? )

какой библиотеки?

Offline

#16  15.05.06 11:33

Re: [C++] SGI или STLPort STL+Borland C++

Той которой otaku подключить не смог ))
Свою тоже можешь выложить, если хочешь )

Offline

#17  15.05.06 11:41

Re: [C++] SGI или STLPort STL+Borland C++

Вообщем то оказалось, что Borland уже сам прикрутил всё что нужно :-)
C++Builder 6 now includes the STLport multiplatform ANSI C++ Standard Library implementation and uses this library by default.
Только проблема теперь другая - как выцепить оттуда hash_map
он упорно его не видит

Offline

#18  15.05.06 12:16

Re: [C++] SGI или STLPort STL+Borland C++

MadSlayer написал(а):

Той которой otaku подключить не смог ))

не помню уж, какая то графическая была

Offline

#19  15.05.06 14:44

Re: [C++] SGI или STLPort STL+Borland C++

reach, А ты собственно файлы библиотеки то подключаешь?

Offline

#20  16.05.06 09:10

Re: [C++] SGI или STLPort STL+Borland C++

Using STLport

Borland C++Builder 6 includes the STLport 4.5 implementation of the C++ Standard Template Library. STLport is a free, open source project that is supported by numerous compilers and platforms.

Rogue Wave implementation included for backward compatibility

C++Builder also retains the Rogue Wave C++ Standard Template Library for backward compatibility. However, STLport is C++Builder's default STL implementation. If you need to build a project using the Rogue Wave library, you must define the macro _USE_OLD_RW_STL, either at the command line (with the -D compiler option), or on the Directories and Conditionals page of the Project Options dialog box.

Using the debug version of STLport

In addition, you can define the symbol _STLP_DEBUG to force C++Builder to build your project with the debug version of the STLport library. Doing so will cause degradation in performance, however, as the debug version contains range checking code, "safe iterators", and precondition checking on algorithms and container methods. More information on using STLport with debugging code can be found on the STLport website (www.stlport.com/doc/debug_mode.html).

List of included header files

The following table describes the hierarchy of the include directory, as it relates to the use of the Rogue Wave and STLport header files. The variable BCB is your local C++Builder installation directory.

Directory Purpose
$(BCB)\include Rogue Wave header files formerly located in this directory, have been moved to ($BCB)\include\oldstl. The header files in the include directory are now wrappers, which will include either the STLport headers, or the Rogue Wave headers, depending on the macro _USE_OLD_RW_STL. The default action is to use the STLport headers (i.e. _USE_OLD_RW_STL is not defined)
$(BCB)\include\config Contains headers used to configure STLport for various build environments. C++Builder uses the file called stl_bc.h for this purpose. You should never edit the contents of this file.
$(BCB)\oldstl Contains the Rogue Wave header files.
$(BCB)\include\stlport Contains top-level header files that wrap internal STLport header files.
$(BCB)\include\stl Contains the internal STLport header files, which are wrapped by the top-level files in the stlport directory. This directory contains the header files that actually define the classes and functions in the STLport library.
$(BCB)\include\using Contains header files used internally by STLport to bring names into the STLport namespace.

The information in this table is provided to help you understand how STLport is currently integrated into C++Builder. You should never put an absolute path to the subdirectories of $(BCB)\include in your code, nor should you add these directories to the Include file path in the Directories and Conditionals page of the Project Options dialog box. These mechanisms were put into place so that switching between the Rogue Wave and STLport implementations would be a simple matter of defining a single macro.

The STLport library can be used in a number of different build configurations. The table below shows the libraries associated with each configuration:

Configuration Link Library Dynamic Link Library
Static, single-threaded stlp.lib N/A
Static, single-threaded, debugging enabled stlp_stldebug.lib N/A
Static, multi-threaded stlpmt.lib N/A
Static, multi-threaded, debugging enabled stlpmt_stldebug.lib N/A
Dynamic, single-threaded stlpi.lib stlp45.dll
Dynamic, single-threaded, debugging enabled stlp_stldebugi.lib stlp_stldebug45.dll
Dynamic, multi-threaded stlpmti.lib stlpmt45.dll
Dynamic, multi-threaded, debugging enabled stlpmt_stldebugi.lib stlpmt_stldebug.dll

C++Builder will automatically link your project with the appropriate library, based on your build settings. You do not need to add any of these libraries directly to your project. This is accomplished using the #pragma comment directive in the STLport configuration header files. You must be sure to distribute the appropriate dynamic link library when you deploy your application.

Вот что написано в документации. Следуя ей - получается всё что нужно - это просто пользоваться тем, что тебе требуется. Ничего особенного делать вроде как не нужно. Так что то не получается :(

Offline

#21  16.05.06 11:22

Re: [C++] SGI или STLPort STL+Borland C++

Ну да lib-ы для dll-ки подключается прямо в хедерах нужных.
Но ты сами то хедеры эти инклюдишь? Например те где этот hash_map лежит?
Ченить типа #include <hash_map> , так помоему в STL?

Offline

#22  16.05.06 13:11

Re: [C++] SGI или STLPort STL+Borland C++

#include <hash_map>
using namespace std;
//или
using std::hash_map;

Offline

#23  17.05.06 08:55

Re: [C++] SGI или STLPort STL+Borland C++

Без 4-го  апдейта на Broland это не работало, теперь всё нормально. Действительно подключается просто с помощью #include <hash_map>.
Теперь вопрос другой - зачем он нужен? :-)))))
Я для своей задачи обошёлся простым map

Offline

#24  17.05.06 12:23

Re: [C++] SGI или STLPort STL+Borland C++

в hash'e трудёмкость поиска очень низкая по сравнению с другими контейнерами

Offline

Программирование и БД » [C++] SGI или STLPort STL+Borland C++ 

ФутЕр:)

© Hostel Web Group, 2002-2025.   Сообщить об ошибке

Сгенерировано за 0.031 сек.
Выполнено 14 запросов.