Objective-C 和 C

标签 objective-c c compiler-errors

我尝试使用“libmsrp”,但是当我尝试编译该库时,出现以下错误:

$ make so
gcc -ggdb -shared -Wl,-soname,libmsrp.so.0 -o libmsrp.so.0.0.2 msrp.o msrp_session.o msrp_message.o msrp_relay.o msrp_switch.o msrp_callback.o msrp_network.o msrp_utils.o -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations  -lpthread
ld: unknown option: -soname
collect2: ld returned 1 exit status
make: *** [so] Error 1

因此,我将 -soname 选项更改为 -dylib_install_name -Wl。编译后出现以下错误:

$ make so
gcc -ggdb -shared -Wl,-dylib_install_name -Wl,libmsrp.dylib.0.0.2 -o libmsrp.dylib.0.0.2 msrp.o msrp_session.o msrp_message.o msrp_relay.o msrp_switch.o msrp_callback.o msrp_network.o msrp_utils.o -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations  -lpthread <p>
Undefined symbols:<p>
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [so] Error 1

所以,我尝试在 Objective-C 项目中进行编译。我添加源文件和头文件并编译项目。

我收到以下错误:

command: MSRP_LIST_FREE(sessions, sessions_lock);

msrp.c:75: error: expected ';' before 'temp'
msrp.c:75: error: 'temp' undeclared (first use in this function)
msrp.c:75: error: 'next' undeclared (first use in this function)
msrp.c:75: error: expected ';' before 'temp'
msrp.c:75: error: 'previous' undeclared (first use in this function)

声明:

#define MSRP_LIST_FREE(list, lock
if(!(list))
    return 0;
else {
    typeof((list)) temp = list, next = NULL;
    while(temp) {
        next = temp->next;
        MSRP_LIST_REMOVE((list), (lock), temp);
        temp = next
    }
}

有什么想法吗?

最佳答案

makefile 可能会处理一些在您从源代码进行编译时未设置的定义。 你应该继续与 make 斗争以使其编译;) 也许,您应该尝试使用 gmake 而不是 make。

关于Objective-C 和 C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3554574/

相关文章:

Python 与 C : Line of Code Comparison vs Dev Time

c - snprintf() 只读到换行符?

c - 链表 - 在中间插入,链接新节点

java - 为什么我的 public void Constructor {} 不能编译?

c++ - C++ 中的类方法等价物

iPhone - 多个 OpenGL (CAEaglelayer) View 的屏幕截图

objective-c - objective-c : calculator app - currentNumber = currentNumber * 10 + digit;

ios - WatchSimulator 3.1 SDK不支持x86_64体系结构?

c++ - 当我用 g++ 编译器编译 c++ 时,错误是什么意思?

Objective-C 内存管理——返回对象时的最佳实践?