Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. Qt Creator中如何优雅地将工程目录下的.a加入.pro中
Qt 6.11 is out! See what's new in the release blog

Qt Creator中如何优雅地将工程目录下的.a加入.pro中

Scheduled Pinned Locked Moved Chinese
2 Posts 2 Posters 6.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    funcman
    wrote on last edited by
    #1

    环境:
    Qt Creator 3.0.0
    Qt 5.2.0
    MinGW 4.8

    有一个libmylib.a库文件,就在我的myproject工程目录内,需要链接给工程。

    我目前的方式是在.pro内的LIBS中写:
    LIBS += -L"../myproject" -lmylib

    因为Qt Creator默认的shadow build,是输出在工程目录平级的build目录。

    但是,有更优雅的方式么?因为build输出目录是可以改成与工程目录不平级的。如果不平级,我这种方式就会出错。

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jiangcaiyang
      wrote on last edited by
      #2

      经过实践,创建一个文件夹,文件夹里面包含.a和写一个pri,内容就是上面那些,然后在pro中写include包含那个pri就好了。

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved