Home > Backend Development > C++ > How Do I Add External Libraries (e.g., Psapi.lib) to My Qt Creator Project?

How Do I Add External Libraries (e.g., Psapi.lib) to My Qt Creator Project?

Patricia Arquette
Release: 2024-12-18 06:33:09
Original
992 people have browsed it

How Do I Add External Libraries (e.g., Psapi.lib) to My Qt Creator Project?

Incorporating External Libraries into Qt Creator Projects

Adding external libraries to a project created with Qt Creator RC1 (version 0.9.2) requires specific steps for successful integration. This guide will walk you through the process using the example of including the Psapi.lib library for accessing the EnumProcesses() function.

Adding the External Library

To add an external library to your project, modify your project's ".pro" file and specify the library's path and name:

LIBS += -L/path/to -lpsapi
Copy after login

Breakdown:

  • -L: Specifies the directory where the library is located.
  • -l: Specifies the library name without the "lib" prefix or ".dll" extension.

Note: If the library is stored within the project directory, use the $$_PRO_FILE_PWD_ variable to reference its location:

LIBS += -L"$$_PRO_FILE_PWD_/3rdparty/libs/" -lpsapi
Copy after login

This ensures platform compatibility, allowing your project to build correctly across various platforms supported by Qt.

The above is the detailed content of How Do I Add External Libraries (e.g., Psapi.lib) to My Qt Creator Project?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template