KEEP K.I.S.S.

tk's blog

link_directories位置问题

tk posted @ Sep 09, 2015 09:13:37 AM in C with tags cmake , 3607 阅读

昨天在Win上整SDL2的编译环境,遇到一个问题。

用的编译器是MinGW(TDM-GCC),因为不想手写Makefile,所以构建工具用的是CMake。在安装好SDL2的头文件和库后,下载了一个示例代码测试。编写CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
project(hellosdl)
aux_source_directory(. DIR_SRCS)
include_directories("D:/mingw_dev_lib/include")
add_definitions("-Wall")
add_executable(main ${DIR_SRCS})
link_directories("D:/mingw_dev_lib/lib")
target_link_libraries(main mingw32 SDL2main SDL2)

mkdir build && cd buildcmake -G "MinGW Makefiles" ..之后mingw32-make,结果链接器ld报错,cannot find -lSDL2maincannot find -lSDL2

应该是链接器找不到SDL2的库文件。但是明明已经添加了link_directories了。

查找link_directories文档,赫然写着

The command will apply only to targets created after it is called.

link_directories这句放到add_executable之前就可以了。

PS: 其实可以通过查看build目录下CMakeFiles\main.dir中的link.txt文件中来确定最终链接器的参数。可以对比下修正前后该文件的内容。

PS2: 其实开始我是通过对比link.txt的文件内容才知道link_directories没有起作用,没有去查阅文档而是直接谷歌。 虽然最后问题解决了,但还是感觉有点2啊(┬_┬)。

sensor sunx 说:
Jan 09, 2023 07:45:02 AM

I found Hubwit as a transparent s ite, a social hub which is a conglomerate of Buyers and Sellers who are ready to offer online digital consultancy at decent cost. ลองเล่นสล็อต joker

SEO 说:
May 08, 2023 03:20:04 PM

Your blogs further more each else volume is so entertaining further serviceable It appoints me befall retreat encore. I will instantly grab your rss feed to stay informed of any updates. 마사지사이트

SEO 说:
May 13, 2023 03:00:13 PM

On this subject internet page, you'll see my best information, be sure to look over this level of detail. 메이저놀이터

SEO 说:
May 27, 2023 09:50:02 PM

I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. 링크주소

SEO 说:
May 30, 2023 02:50:54 AM

On this page, you'll see my profile, please read this information. 소액결제현금화

SEO 说:
Jun 01, 2023 04:36:36 AM

Welcome to the party of my life here you will learn everything about me. 수원출장마사지

SEO 说:
Jun 18, 2023 09:55:48 PM Thanks for taking the time to discuss that, I feel strongly about this and so really like getting to know more on this kind of field. Do you mind updating your blog post with additional insight? It should be really useful for all of us. 대구의밤
Adilkhatri 说:
Aug 14, 2023 02:03:02 PM

SLC's drain and sewer specialists keep your plumbing systems flowing smoothly, preventing inconvenient backups. SLC's Drain and Sewer Specialists

Adilkhatri 说:
Aug 15, 2023 11:37:44 PM

Fast emergency plumbing response resolves urgent issues promptly, preventing further damage and minimizing disruptions. Fast Emergency Plumbing Response

Adilkhatri 说:
Aug 17, 2023 08:51:34 PM

Are you passionate about fashion and eager to learn the art of tailoring? Look no further than the renowned "Chennai Fashion Institute," where your dreams of becoming a skilled tailor can come true! Tailoring Classes near me

Adilkhatri 说:
Aug 23, 2023 06:28:38 PM

This is essential, however it's important to enable you to make a beeline for it weblink: Roma Slot

Johny 说:
Aug 28, 2023 06:10:03 PM

Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. familie vakantie naar stkanzian

SEO 说:
Aug 29, 2023 06:11:58 PM

This content is simply exciting and creative. I have been deciding on a institutional move and this has helped me with one aspect. TRUEMAN CBD GUMMIES

secure file transfer 说:
Sep 03, 2023 05:28:36 AM

Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also.

Johny 说:
Sep 03, 2023 11:00:43 PM

You have a good point here!I totally agree with what you have said!!Thanks for sharing your views...hope more people will read this article!!! rtp mumunbet

Johny 说:
Sep 08, 2023 10:19:52 PM

I read a article under the same title some time ago, but this articles quality is much, much better. How you do this.. agen judi slot online

jsimitseo 说:
Sep 13, 2023 04:12:47 PM

Hello, I found your blog per Google bit looking for such kinda instructive prompt also your educate sees extremely noteworthy for me.  เว็บสล็อตเปิดใหม่2023

jsimitseo 说:
Sep 13, 2023 08:07:40 PM

I can suggest essentially not too bad and even dependable tips, accordingly see it:  Roma Slot

Adilkhatri 说:
Sep 20, 2023 05:32:14 PM

Such an especially significant article. To a great degree charming to examine this article.I should need to thank you for the undertakings you had made for creating this astonishing article. 먹튀검증

acim 说:
Sep 24, 2023 04:27:14 PM

Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks

Adilkhatri 说:
Sep 28, 2023 02:40:09 PM

I need you to thank for your season of this great read!!! I definately appreciate each and every piece of it and I have you bookmarked to look at new stuff of your blog an unquestionable requirement read blog! Chickens

Adilkhatri 说:
Sep 28, 2023 07:10:24 PM

I am scanning for and I need to post a comment that "The substance of your post is grand" Great work! Optifine Tlauncher

Adilkhatri 说:
Sep 28, 2023 07:38:00 PM

A debt of gratitude is in order for such an extraordinary post and the audit, I am completely inspired! Keep stuff like this coming. Massage Guns For Athletes

Adilkhatri 说:
Sep 28, 2023 07:58:48 PM

A debt of gratitude is in order for such an extraordinary post and the audit, I am completely inspired! Keep stuff like this coming. Seven Ways to Avoid Back Pain for Office Workers

Adilkhatri 说:
Sep 28, 2023 08:19:33 PM

Incredible post I should state and much obliged for the data. Instruction is unquestionably a sticky subject. Be that as it may, is still among the main themes of our opportunity. I value your post and anticipate more. Delaware incorporation services

Adilkhatri 说:
Sep 29, 2023 02:10:44 PM

I need you to thank for your season of this great read!!! I definately appreciate each and every piece of it and I have you bookmarked to look at new stuff of your blog an unquestionable requirement read blog! Tech Startup Legal Package

Adilkhatri 说:
Oct 02, 2023 02:33:03 PM

A debt of gratitude is in order for such an extraordinary post and the audit, I am completely inspired! Keep stuff like this coming. whatsapp integration

Adilkhatri 说:
Oct 03, 2023 05:41:24 PM

Extremely pleasant and fascinating post. I was searching for this sort of data and delighted in perusing this one. 대구칵테일바

Adilkhatri 说:
Oct 08, 2023 02:07:43 PM

Extremely pleasant and fascinating post. I was searching for this sort of data and delighted in perusing this one. ATIVAN LORAZEPAM

Adilkhatri 说:
Oct 10, 2023 08:38:27 PM

I likewise composed an article on a comparative subject will discover it at compose what you think. juice bar los angeles

Adilkhatri 说:
Oct 11, 2023 02:06:22 PM Astonishing learning and I get a kick out of the chance to impart this sort of data to my companions and expectation they like it they why I do 천안아가씨알바
jsimitseo 说:
Oct 13, 2023 08:58:40 PM

This is essential, however it's important to enable you to make a beeline for it weblink:  Roma Slot

Adilkhatri 说:
Oct 14, 2023 02:01:18 PM

A debt of gratitude is in order for the instructive and accommodating post, clearly in your blog everything is great.. tiktok download shortcut

Adilkhatri 说:
Oct 14, 2023 02:08:14 PM

I just got to this astonishing site in the relatively recent past. I was really caught with the bit of assets you have here. Enormous thumbs up for making such brilliant blog page! tiktok engagement calculator

Adilkhatri 说:
Oct 14, 2023 02:36:30 PM

It is amazingly decent to see the best subtle elements introduced in a simple and understanding way. Washing machine repair in Orange County

Adilkhatri 说:
Oct 14, 2023 03:05:35 PM

I feel particularly appreciative that I read this. It is especially useful and to an awesome degree important and I incredibly took in an inconceivable game plan from it. visit more

sirajuddin 说:
Oct 15, 2023 06:52:49 PM

nice bLog! its interesting. thank you for sharing.... buy transparent bra

Adilkhatri 说:
Oct 17, 2023 06:22:51 PM I need you to thank for your season of this great read!!! I definately appreciate each and every piece of it and I have you bookmarked to look at new stuff of your blog an unquestionable requirement read blog! plexiglass swimming pool
Adilkhatri 说:
Oct 18, 2023 07:23:41 PM

This is likewise a decent post which I truly appreciated perusing. It isn't each day that I have the likelihood to see something like this.. Delaware incorporation

Adilkhatri 说:
Oct 19, 2023 01:45:23 PM

The author is energetic about acquiring wooden furniture on the web and his investigation about best wooden furniture has realized the plan of this article. glucotrust reviews

Adilkhatri 说:
Oct 20, 2023 01:48:56 PM

It is fantastically normal to see the best subtle segments introduced in a fundamental and seeing way. fabbro milano

jsimitseo 说:
Oct 20, 2023 03:07:19 PM

I can suggest essentially not too bad and even dependable tips, accordingly see it:  168bet

Johny 说:
Oct 21, 2023 05:58:20 PM

Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. ufabetทางเข้าเล่น

Adilkhatri 说:
Oct 21, 2023 09:38:16 PM

A to a great degree brilliant blog passage. We are really grateful for your blog passage. fight, law usage You will find an extensive measure of techniques in the wake of heading off to your post. I was absolutely examining for. An obligation of appreciation is all together for such post and please keep it up. Mind blowing work. SaaS Contract Lawyer

William SEO 说:
Oct 23, 2023 06:41:04 PM

A debt of gratitude is in order for the instructive and accommodating post, clearly in your blog everything is great.. Save The Date

William SEO 说:
Oct 25, 2023 01:53:30 PM

Wow what a Great Information about World Day its incredibly charming instructive post. an obligation of appreciation is all together for the post. Canyoneering in Badian

William SEO 说:
Oct 27, 2023 03:09:14 PM

Mmm.. great to be here in your article or post, whatever, I figure I ought to likewise buckle down for my own site like I see some great and refreshed working in your site. ceramiche sassuolo

William SEO 说:
Oct 27, 2023 03:13:06 PM

Attempting to express profound gratitude won't just be sufficient, for the fantasti c lucidity in your composed work. I will rapidly get your rss channel to stay taught of any updates. ceramica sassuolo

William SEO 说:
Oct 27, 2023 03:17:12 PM

Simply unadulterated eminence from you here. I have never expected something not as much as this from you and you have not puzzled me by any stretch out of the inventive vitality. I acknowledge you will keep the quality work going on. pavimenti sassuolo

William SEO 说:
Oct 28, 2023 05:44:50 PM Wow what a Great Information about World Day its incredibly charming instructive post. an obligation of appreciation is all together for the post. Real estate lawyer Montgomery New York
William SEO 说:
Oct 28, 2023 08:41:38 PM

Endeavoring to offer significant thanks won't simply be adequate, for the fantasti c clarity in your formed work. I will quickly get your rss channel to stay instructed of any updates. start a LLC New York

William SEO 说:
Oct 29, 2023 01:03:33 PM

Wow what a Great Information about World Day its incredibly charming instructive post. an obligation of appreciation is all together for the post. Everything above

William SEO 说:
Oct 30, 2023 06:10:54 PM

A debt of gratitude is in order for such an extraordinary post and the audit, I am completely inspired! Keep stuff like this coming. Abortion Clinic Calgary

William SEO 说:
Oct 30, 2023 06:41:29 PM

I need you to thank for your season of this great read!!! I definately appreciate each and every piece of it and I have you bookmarked to look at new stuff of your blog an unquestionable requirement read blog! piastrelle sassuolo

William SEO 说:
Oct 30, 2023 06:57:01 PM

In the wake of perusing your article I was stunned. I realize that you clarify it exceptionally well. What's more, I trust that different perusers will likewise encounter how I feel in the wake of perusing your article. fabbro milano centro

William SEO 说:
Oct 30, 2023 06:57:13 PM

It ought to be seen that while requesting papers available to be gained at paper making association, you can get unkind point of view. On the off chance that you feel that the pro is endeavoring to cheat you, don't purchase ask about assignment from it. pronto intervento fabbro milano

William SEO 说:
Nov 02, 2023 03:37:45 PM

The author is energetic about acquiring wooden furniture on the web and his investigation about best wooden furniture has realized the plan of this article. ceramica sassuolo

William SEO 说:
Nov 02, 2023 03:48:11 PM

Gangaur Realtech is a professionally overseen association work in land administrations where incorporated administrations are given by experts to its customers looking for expanded an incentive by owning, possessing or putting resources into land. fabbro milano

William SEO 说:
Nov 02, 2023 04:02:00 PM

Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here. couples honeymoon shirts

William SEO 说:
Nov 03, 2023 12:41:53 PM

This post is extremely radiant. I extremely like this post. It is outstanding amongst other posts that I ve read in quite a while. Much obliged for this better than average post. I truly value it! Gemstone Jewelry manufacturer

William SEO 说:
Nov 08, 2023 06:19:15 PM

Trying to say thanks won't simply be adequate, for the fantasti c clarity in your written work. I will quickly get your rss channel to remain educated of any updates. citoteque valor mercado livre

William SEO 说:
Nov 09, 2023 08:07:31 PM Extremely pleasant and fascinating post. I was searching for this sort of data and delighted in perusing this one. siti internet parma
William SEO 说:
Nov 09, 2023 08:11:31 PM

I unquestionably appreciating each and every piece of it and I have you bookmarked to look at new stuff you post. noleggio auto modena

William SEO 说:
Nov 09, 2023 08:29:49 PM

Intriguing post. I Have Been pondering about this issue, so a debt of gratitude is in order for posting. Entirely cool post.It 's extremely exceptionally decent and Useful post.Thanks click

William SEO 说:
Nov 11, 2023 03:31:06 PM

A debt of gratitude is in order for such an extraordinary post and the audit, I am completely inspired! Keep stuff like this coming. persian market near me

William SEO 说:
Nov 11, 2023 04:04:49 PM

This is in like manner an OK post which I really refreshing scrutinizing. It isn't every day that I have the probability to see something like this.. atestado médico

SEO Expert 说:
Nov 11, 2023 07:03:42 PM

Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks New Jersey

SEO Expert 说:
Nov 12, 2023 03:37:59 PM

Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks startup attorney

William SEO 说:
Nov 14, 2023 11:06:07 PM

The author is energetic about acquiring wooden furniture on the web and his investigation about best wooden furniture has realized the plan of this article. Make Effective Cleaning Solution for Bathroom Tiles

William SEO 说:
Nov 15, 2023 02:41:24 PM On this page, you'll see my profile, please read this data. pasar123 server taiwan
William SEO 说:
Nov 15, 2023 08:32:02 PM I am overpowered by your post with such a decent theme. Typically I visit your web journals and get refreshed through the data you incorporate yet the present blog would be the most obvious. Well done! 홍대가라오케
William SEO 说:
Nov 17, 2023 06:38:35 PM

This is likewise a decent post which I truly appreciated perusing. It isn't each day that I have the likelihood to see something like this.. refrigerator repair in Orange County

William SEO 说:
Nov 18, 2023 02:21:09 PM

The author is energetic about acquiring wooden furniture on the web and his investigation about best wooden furniture has realized the plan of this article. where to order semaglutide online

William SEO 说:
Nov 22, 2023 02:44:15 PM

The author is energetic about acquiring wooden furniture on the web and his investigation about best wooden furniture has realized the plan of this article. Startup Business Contracts

williamSEO 说:
Nov 23, 2023 02:18:45 PM

The author is energetic about acquiring wooden furniture on the web and his investigation about best wooden furniture has realized the plan of this article. con que puedo rellenar el sushi

williamSEO 说:
Nov 23, 2023 02:40:59 PM

This is in like manner an OK post which I really refreshing scrutinizing. It isn't every day that I have the probability to see something like this.. Global Perspectives: Opportunities Beyond Borders in the Investing Landscape

williamSEO 说:
Nov 23, 2023 09:39:53 PM

The author is energetic about acquiring wooden furniture on the web and his investigation about best wooden furniture has realized the plan of this article. Guides To Heavy Duty Automatic Metal Coil Blanking Line

williamSEO 说:
Nov 23, 2023 10:27:21 PM

A debt of gratitude is in order for such an extraordinary post and the audit, I am completely inspired! Keep stuff like this coming. www.nneellinvest.com/investing/financial-markets-in-the-post-pandemic-era/

WilliamSEO 说:
Nov 27, 2023 02:35:34 PM

UFABET's commitment to fair play and security is evident. I feel safe betting here. UFABETแทงบอลมือถือยอดนิยม

SEO 说:
Nov 27, 2023 06:20:40 PM

These things are very important, good think so - I think so too... pola jackpot

WilliamSEO 说:
Nov 27, 2023 08:00:29 PM

Mmm.. great to be here in your article or post, whatever, I figure I ought to likewise buckle down for my own site like I see some great and refreshed working in your site. Healing After Sexual Assault

WilliamSEO 说:
Nov 27, 2023 09:47:30 PM

I am awed by the data that you have on this blog. It demonstrates how well you comprehend this subject. UFABETเว็บบอลคนเล่นเยอะสุด

WilliamSEO 说:
Nov 28, 2023 02:13:39 PM Trying to say thanks won't simply be adequate, for the fantasti c clarity in your written work. I will quickly get your rss channel to remain educated of any updates. UFABETสมัครเว็บเดิมพันตรง
WilliamSEO 说:
Nov 28, 2023 06:22:46 PM

The author is energetic about acquiring wooden furniture on the web and his investigation about best wooden furniture has realized the plan of this article. Cash Rewards

SEO Expert 说:
Nov 29, 2023 04:16:40 PM

You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. forex robot

WilliamSEO 说:
Nov 29, 2023 06:11:47 PM

Looking for Smoky Mountain outdoor activities in Gatlinburg and Pigeon Forge? Big Rock Dude Ranch at Ponderosa is the Gatlinburg / Pigeon Forge area's premier horseback riding and outdoor adventure destination. Horseback riding Pigeon Forge

WilliamSEO 说:
Nov 29, 2023 06:21:33 PM

Place our handmade aromatic bath bombs in your tub and enjoy the sizzle. Water dissolves the essential oils in our bath bombs, leaving your skin silky smooth. Handmade with all-natural ingredients. Our bath bombs will leave your skin smooth and fresh. bath bombs

WilliamSEO 说:
Nov 29, 2023 06:21:38 PM

Ray Of Light Media web design in Pigeon Forge, TN specializes in e-commerce, database driven sites, responsive mobile sites, CMS, simple online presence, search engine optimization, and interactive 360-degree virtual tours. Knoxville web design

SEO Expert 说:
Nov 29, 2023 07:44:57 PM

I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. esta us visa eligibility italian citizens

WilliamSEO 说:
Nov 29, 2023 11:07:53 PM

Gangaur Realtech is a professionally overseen association work in land administrations where incorporated administrations are given by experts to its customers looking for expanded an incentive by owning, possessing or putting resources into land. ceramiche sassuolo

WilliamSEO 说:
Dec 01, 2023 02:22:39 PM

Gangaur Realtech is a professionally overseen association work in land administrations where incorporated administrations are given by experts to its customers looking for expanded an incentive by owning, possessing or putting resources into land. house washing brisbane

Linker SEO 说:
Dec 02, 2023 06:34:07 PM

With a rich history of innovation and a commitment to shaping the future, Southchip continues to inspire and redefine the possibilities of semiconductor technology. The journey is ongoing, and the best, undoubtedly, is yet to come. Robust semiconductor supply chain

Linker SEO 说:
Dec 02, 2023 08:09:38 PM

From setting deposit limits to self-exclusion options, these measures ensure that the thrill remains enjoyable and within healthy bounds. 신뢰할수있는 카지노사이트 추천


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter