danfis / libccd

Library for collision detection between two convex shapes
Other
478 stars 108 forks source link

Problem with the linking #33

Open OM92 opened 7 years ago

OM92 commented 7 years ago

Hello, first of all, I want to say a big thank you to danfis for the library. I am completely new to the library and want to start to use it. I already installed it and I am trying to compile the example GJK - Intersection Test. However, I am encountering a linking problem with the lines: CCD_INIT(&ccd); // initialize ccd_t struct int intersect = ccdGJKIntersect(obj1, obj2, &ccd); in the main function and the compiler is giving me the following error messages: undefined reference to _imp__ccdFirstDirDefault' undefined reference to_imp__ccdGJKIntersect'

I did add the library libccd in my compiler so I don't understand why the compiler can't find those functions. My questions may be trivial and maybe it is not right place to post it, but I couldn't find any help anywhere else.

I am using windows 7 and Mingw Any help would be much appreciated. Thank you in advance

JXLee33 commented 6 years ago

I have the same problem. You can try to add extern int ccdGJKIntersect(const void obj1, const void obj2, const ccd_t *ccd) before main() function. And if you find red line under CCD_INIT,you can try this https://github.com/danfis/libccd/pull/40/files

vekkuli commented 5 years ago

I had similar linking issues. I had set the library to be built static in cmake but it seemed like the CCD_EXPORT definition wasn't right. Is the CCD_STATIC_DEFINE defined properly? Anyway, I was able to resolve the issue by overriding the ccd_export.h with

#ifndef CCD_EXPORT_H
#define CCD_EXPORT_H

#define CCD_EXPORT

#endif
Mikez2015 commented 4 years ago

Have same problem - fatal error LNK1120. I tried to do as advised vekkuli, but it did not help.

Mikez2015 commented 4 years ago

I have the same problem. You can try to add extern int ccdGJKIntersect(const void obj1, const void obj2, const ccd_t *ccd) before main() function.

warning C4273: ccdGJKIntersect:

JXLee33 commented 4 years ago

Warning means you can run it but you still have some potential problem. In most situation, it is just a useless hint. It depends on your compiler.

------------------ 原始邮件 ------------------ 发件人: "Mikez2015"<notifications@github.com>; 发送时间: 2020年2月18日(星期二) 下午3:17 收件人: "danfis/libccd"<libccd@noreply.github.com>; 抄送: "X"<1072324172@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [danfis/libccd] Problem with the linking (#33)

I have the same problem. You can try to add extern int ccdGJKIntersect(const void obj1, const void obj2, const ccd_t *ccd) before main() function. And if you find red line under CCD_INIT,you can try this https://github.com/danfis/libccd/pull/40/files

warning C4273: ccdGJKIntersect:

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Mikez2015 commented 4 years ago

Warning means you can run it but you still have some potential problem. In most situation, it is just a useless hint. It depends on your compiler.

But I still get the error LNK1120. I tried different tips, but nothing helps.

JXLee33 commented 4 years ago

Please tell me your compiler, if you use visual stdio2015, maybe I could give you my test program.

------------------ 原始邮件 ------------------ 发件人: "Mikez2015"<notifications@github.com>; 发送时间: 2020年2月18日(星期二) 下午3:53 收件人: "danfis/libccd"<libccd@noreply.github.com>; 抄送: "X"<1072324172@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [danfis/libccd] Problem with the linking (#33)

Warning means you can run it but you still have some potential problem. In most situation, it is just a useless hint. It depends on your compiler. … ------------------ 原始邮件 ------------------ 发件人: "Mikez2015"<notifications@github.com>; 发送时间: 2020年2月18日(星期二) 下午3:17 收件人: "danfis/libccd"<libccd@noreply.github.com>; 抄送: "X"<1072324172@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [danfis/libccd] Problem with the linking (#33) I have the same problem. You can try to add extern int ccdGJKIntersect(const void obj1, const void obj2, const ccd_t *ccd) before main() function. And if you find red line under CCD_INIT,you can try this https://github.com/danfis/libccd/pull/40/files warning C4273: ccdGJKIntersect: — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

But I still get the error LNK1120. I tried different tips, but nothing helps.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Mikez2015 commented 4 years ago

Please tell me your compiler, if you use visual stdio2015, maybe I could give you my test program.

Latest VS 2019, x64

JXLee33 commented 4 years ago

This is a test program for cube, open libccdtest.sln, maybe it works.

------------------ 原始邮件 ------------------ 发件人: "Mikez2015"<notifications@github.com>; 发送时间: 2020年2月18日(星期二) 下午5:05 收件人: "danfis/libccd"<libccd@noreply.github.com>; 抄送: "X"<1072324172@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [danfis/libccd] Problem with the linking (#33)

Please tell me your compiler, if you use visual stdio2015, maybe I could give you my test program. Latest VS 2019, x64

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Mikez2015 commented 4 years ago

This is a test program for cube, open libccdtest.sln, maybe it works.

Where? I do not see the link.

JXLee33 commented 4 years ago

At first, I used the link as I said in the comment.But then I found that it is more convenient to put some files directly into the project.I couldn't find the original version.Sorry.😐

---Original--- From: "Mikez2015"<notifications@github.com> Date: Tue, Feb 18, 2020 19:17 PM To: "danfis/libccd"<libccd@noreply.github.com>; Cc: "Comment"<comment@noreply.github.com>;"JXLee33"<1072324172@qq.com>; Subject: Re: [danfis/libccd] Problem with the linking (#33)

This is a test program for cube, open libccdtest.sln, maybe it works.

Where? I do not see the link.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Mikez2015 commented 4 years ago

At first, I used the link as I said in the comment.But then I found that it is more convenient to put some files directly into the project.I couldn't find the original version.Sorry.😐 ---Original--- From: "Mikez2015"<notifications@github.com> Date: Tue, Feb 18, 2020 19:17 PM To: "danfis/libccd"<libccd@noreply.github.com>; Cc: "Comment"<comment@noreply.github.com>;"JXLee33"<1072324172@qq.com>; Subject: Re: [danfis/libccd] Problem with the linking (#33) This is a test program for cube, open libccdtest.sln, maybe it works. Where? I do not see the link. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

No problems, thx.

I found sulution: Add "#define CCD_STATIC_DEFINE" to "config.h" and copy to includes. It's work for me.

SpaceIm commented 4 years ago

I've solved linkage errors with msvc like this. If static, CCD_STATIC_DEFINE has to be defined:

CMakeLists.txt of libccd could be easily fixed by defining CCD_STATIC_DEFINE not only when CCD_HIDE_ALL_SYMBOLS is ON, but also when BUILD_SHARED_LIBS is OFF.