iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
ivanlw
V2EX  ›  iDev

编译C++静态库的问题,急!

  •  
  •   ivanlw ·
    tolinwei · May 25, 2012 · 3288 views
    This topic created in 5126 days ago, the information mentioned may be changed or developed.
    现在有这个库的源码,然后新建了一个cocoa touch library,添加进所有源码,编译出来了.a的文件

    然后在需要用的工程里面添加了.a文件,并添加到target里面

    这时候编译提示没有找到.h文件

    然后设置了Header Search Paths,这时候没有提示.h缺失的错误了,但是出来了这些错误

    file was built for archive which is not the architecture being linked (i386)
    "_scws_new", referenced from:
    -[scwsTestViewController viewDidLoad] in scwsTestViewController.o
    "_scws_set_charset", referenced from:
    -[scwsTestViewController viewDidLoad] in scwsTestViewController.o

    感觉应该是编译出来的库不支持i386,然后去用lipo -info查看了编译出来了.a文件,果然只支持armv7,请问怎么设置工程,才能编译出来支持i386的静态哭库呢?!

    网上搜了很多相关的,都没有提到architecture设置的问题
    4 replies    1970-01-01 08:00:00 +08:00
    raptium
        1
    raptium  
       May 25, 2012
    既然是 cocoa touch,那就是 iOS 上的了,那自然不会有 i386 了
    wtl
        2
    wtl  
       May 25, 2012
    你需要编译一个universal library。


    最简单的方法,不要直接拖.a, 而是在你的项目中加入静态库,然后链接这个静态库的target。
    wtl
        3
    wtl  
       May 25, 2012
    但那样往往每次clean之后静态库也会重新编译,没有直接引用.a快当。
    如果你的库很大的话,还是编一个universal library好了。
    yelusiku
        4
    yelusiku  
       May 25, 2012
    现在都流行这个 https://github.com/kstenerud/iOS-Universal-Framework 了。一般人我不告诉他 :)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   978 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 18:22 · PVG 02:22 · LAX 11:22 · JFK 14:22
    ♥ Do have faith in what you're doing.