フィルターのクリア

unresolved external symbol link error with R2009b and VC++2008 express sp1

1 回表示 (過去 30 日間)
Sangkyun Kim
Sangkyun Kim 2011 年 7 月 19 日
Hello
I tried to start use c-mex function of Matlab recently. I use R2009b, and VC++2008 express sp1 for the c compliler. As I use just simple equations on c file, such as twotimes function, there is no problem.
However, when I use some external library for the simple socket programming, I got below link error messages.
--------------------------------------------
error LNK2019: unresolved external symbol __imp_listen referenced in function mdlInitializeConditions
---------------------------------------------
I read many useful helps in this site, and tried many things, but this error is not disappeared. It looks like I have to select library path for the Matlab. But I dont have any clues.
If someone answer how to solve this problem, it will be great help.

採用された回答

Friedrich
Friedrich 2011 年 7 月 19 日
Hi,
without some more details it hard to tell whats wrong. Maybe the Microsoft doc can help:
You have to make sure that the compiler/linker can see the needed header and libraries. For this you have the -I and -L options in the mex command.
  3 件のコメント
Friedrich
Friedrich 2011 年 7 月 20 日
I am not a great friend of copying libraries. What happens when you compile it this way:
mex('-v','sfun.c','-LC:\Program Files\Microsoft SDKs\Windows\v7.0\Lib\x64','-lWS2_32')
Please do not specify the .lib since the doc states:
On Windows systems, name expands to name.lib or libname.lib and on UNIX systems, to libname.so or libname.dylib.
Sangkyun Kim
Sangkyun Kim 2011 年 7 月 21 日
Your comment works perfectly.
I did not know .lib is not necessary.
Thank you! Fridrich

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeC Shared Library Integration についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by