Ссылки DLL в Visual C++

Должен быть способ использования только java8 jdk, нет?

В базовых Java-классах нет объектов, которые понимают документы PDF. Я имею в виду, что вы можете технически посмотреть спецификацию PDF и выяснить, как написать свой собственный анализатор. Вероятно, это будут недели работы и тысячи строк кода. Или вы можете взять библиотеку, прочитать некоторые учебники и сделать это менее чем за полчаса.

Одним из самых больших преимуществ кодирования в Java (помимо цели JVM «напиши один раз, беги куда угодно») является то, что это очень зрелый язык с тысячами и тысячами доступных библиотек.

44
задан Rish 4 August 2016 в 05:45
поделиться

3 ответа

You need to do a couple of things to use the library:

  1. Make sure that you have both the *.lib and the *.dll from the library you want to use. If you don't have the *.lib, skip #2

  2. Put a reference to the *.lib in the project. Right click the project name in the Solution Explorer and then select Configuration Properties->Linker->Input and put the name of the lib in the Additional Dependencies property.

  3. You have to make sure that VS can find the lib you just added so you have to go to the Tools menu and select Options... Then under Projects and Solutions select VC++ Directories,edit Library Directory option. From within here you can set the directory that contains your new lib by selecting the 'Library Files' in the 'Show Directories For:' drop down box. Just add the path to your lib file in the list of directories. If you dont have a lib you can omit this, but while your here you will also need to set the directory which contains your header files as well under the 'Include Files'. Do it the same way you added the lib.

After doing this you should be good to go and can use your library. If you dont have a lib file you can still use the dll by importing it yourself. During your applications startup you can explicitly load the dll by calling LoadLibrary (see: http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx for more info)

Cheers!

EDIT

Remember to use #include < Foo.h > as opposed to #include "foo.h". The former searches the include path. The latter uses the local project files.

78
ответ дан 26 November 2019 в 22:06
поделиться

The additional include directories are relative to the project dir. This is normally the dir where your project file, *.vcproj, is located. I guess that in your case you have to add just "include" to your include and library directories.

If you want to be sure what your project dir is, you can check the value of the $(ProjectDir) macro. To do that go to "C/C++ -> Additional Include Directories", press the "..." button and in the pop-up dialog press "Macros>>".

2
ответ дан 26 November 2019 в 22:06
поделиться

You mention adding the additional include directory (C/C++|General) and additional lib dependency (Linker|Input), but have you also added the additional library directory (Linker|General)?

Including a sample error message might also help people answer the question since it's not even clear if the error is during compilation or linking.

1
ответ дан 26 November 2019 в 22:06
поделиться
Другие вопросы по тегам:

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