Как я устанавливаю библиотеку C++, таким образом, я могу использовать ее?

gcc реализует расширение языка C для поддержки последовательных диапазонов:

switch (value)
{
   case 1...3:
      //Do Something
      break;
   case 4...6:
      //Do Something
      break;
   default:
      //Do the Default
      break;
}

Редактирование : Просто замеченный C# наклеивают вопрос, поэтому по-видимому, ответ gcc не помогает.

23
задан AStopher 16 November 2014 в 10:54
поделиться

2 ответа

Installing a C++ library means specifying to interested software (eg. a compiler) the location of two kinds of files: headers (typical extensions *.h or .hpp) and compiled objects (.dll or *.lib for instance).

The headers will contain the declarations exposed to the developer by the library authors, and your program will #include them in its source code, the dll will contain the compiled code which will be or linked together and used by your program, and they will be found by the linker (or loaded dynamically, but this is another step).

So you need to

1) put the header files in a location which your compiler is aware of (typically IDE allows to set so-called include directories, otherwise you specify a flag like "-I<path-to-headers>" when invoking the compiler)
2) put the dll files in a location which your linker is aware of (surely your IDE will allow that, otherwise you speficy a flag like "-L<path-to-libraries> -l<name-of-libraries>"

Last but not least, since I see that BASS library is a commercial product, probably they will have made available some installation instructions?

18
ответ дан 29 November 2019 в 02:53
поделиться

Если есть файлы с именами configure , Makefile или install , вы можете попробовать запустить их в указанном порядке. После этого любая программа, которая хочет соединиться с этой библиотекой, должна использовать такую ​​команду:

c++ <your_program.cpp> -l<library_name> -L<path_where_library_is_installed>

Путь к библиотеке обычно является самой исходной папкой библиотеки, если вы явно не измените ее или сама библиотека не поместит свои файлы в глобальные местоположения, такие как / usr / local или что-то в этом роде.

1
ответ дан 29 November 2019 в 02:53
поделиться
Другие вопросы по тегам:

Похожие вопросы: