Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
291 views
in Technique[技术] by (71.8m points)

c++ - Adding linker options to Code::Blocks

When i try to run an executable compiled with Code::Blocks on my Win 7 x64 machine, it says it cannot run because the libgcc_s_dw2-1 is missing.

I found a solution, to include the library in the linker options. (here is the reference i got it from: http://forums.codeblocks.org/index.php?topic=16748.0;prev_next=prev. look at the last post)

The thing is, when i go to the linker settings, in Project Build Options, there are no libraries available there. Do i have to download the

-static-libgcc
-static-libstdc++

as stated by the post, and put them in a directory so Code::Blocks can see them and add them to the linker options? If yes, where do i put the libraries?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Never mind, i found the answer in this post http://forums.codeblocks.org/index.php/topic,15998.0.html

To sum up, in Code Blocks, go to

"Settings" -> "Compiler and debugger..."
"Global compiler settings"
"Linker settings"

Then add the following options to `"Other linker options":

-static-libgcc -static-libstdc++

Then you are off to go...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...