相关疑难解决方法(0)

编译glib时链接器错误...?

我在Ubuntu上针对glib编译一个简单的示例程序时遇到了麻烦.我收到以下错误.我可以让它编译但不与-c标志链接,我相信这意味着我安装了glib标头,但它没有找到共享对象代码.另请参阅下面的Make文件.

$> make re
gcc -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include  -lglib-2.0       re.c   -o re
/tmp/ccxas1nI.o: In function `print_uppercase_words':
re.c:(.text+0x21): undefined reference to `g_regex_new'
re.c:(.text+0x41): undefined reference to `g_regex_match'
re.c:(.text+0x54): undefined reference to `g_match_info_fetch'
re.c:(.text+0x6e): undefined reference to `g_print'
re.c:(.text+0x7a): undefined reference to `g_free'
re.c:(.text+0x8b): undefined reference to `g_match_info_next'
re.c:(.text+0x97): undefined reference to `g_match_info_matches'
re.c:(.text+0xa7): undefined reference to `g_match_info_free'
re.c:(.text+0xb3): undefined reference to `g_regex_unref'
collect2: ld returned 1 exit status
make: *** [re] Error 1
Run Code Online (Sandbox Code Playgroud)

Makefile 用过的:

# Need to …
Run Code Online (Sandbox Code Playgroud)

c linker compilation

10
推荐指数
1
解决办法
2万
查看次数

gcc undefined引用

我在跑..

gcc -c -I/usr/vt/sample ttssample.c
gcc -L. -lttsapi ttssample.o -o ttsample
Run Code Online (Sandbox Code Playgroud)

我收到以下错误...

ttssample.o: In function `_TTSFile':
ttssample.c:(.text+0x352): undefined reference to `TTSRequestFile'
ttssample.o: In function `_TTSFileEx':
ttssample.c:(.text+0x5e0): undefined reference to `TTSRequestFileEx'
ttssample.o: In function `_TTSBuffer':
ttssample.c:(.text+0x833): undefined reference to `_TTSRequestBuffer'
ttssample.o: In function `_TTSBufferEx':
ttssample.c:(.text+0xabd): undefined reference to `_TTSRequestBufferEx'
ttssample.o: In function `_TTSBuffering_cont':
ttssample.c:(.text+0xcbf): undefined reference to `_TTSRequestBuffer'
ttssample.o: In function `_TTSBuffering_stop':
ttssample.c:(.text+0xf2d): undefined reference to `_TTSRequestBuffer'
ttssample.o: In function `_TTSBuffering_SSML':
ttssample.c:(.text+0x122b): undefined reference to `_TTSRequestBufferSSMLEx'   
ttssample.o: In function `_TTSStatus':
ttssample.c:(.text+0x157b): …
Run Code Online (Sandbox Code Playgroud)

gcc undefined-reference

9
推荐指数
1
解决办法
3万
查看次数

标签 统计

c ×1

compilation ×1

gcc ×1

linker ×1

undefined-reference ×1