[TUTORIAL] Compiling the DLL on Linux

I took the time to setup everything with the GNUmakefile solution. Unfortunately I get an error in the # Link objects. step of the makefile:

LINK : fatal error LNK1104: cannot open file 'Project/CvGameCoreDLL.def'
LINK : fatal error LNK1141: failure during build of exports file
make: *** [GNUmakefile:104: release/CvGameCoreDLL.dll] Error 117

My question what is this CvGameCoreDLL.def? I didn't find any file of that kind in my setup?

Thanks a lot for the great explanations so far.
Thank you for testing it.

The def file is an oversight; I inherited it from AdvCiv, but it shouldn't be in the default makefile. (Instead, you'd just set LDFLAGS in .settings if your mod needs it. Probably I should document this too...)
I've updated the makefile (and the link to the zip). Could you please try it again?
 
Tried it with the following result, but right now I don't have much time to analyse.

Creating library release/CvGameCoreDLL.lib and object release/CvGameCoreDLL.exp
CvGame.obj : error LNK2019: unresolved external symbol "int __cdecl boost::xtime_get(struct boost::xtime *,int)" (?xtime_get@boost@@YAHPAUxtime@1@H@Z) referenced in function "private: void __thiscall Timer::c
alc_next_time(void)" (?calc_next_time@Timer@@AAEXXZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::detail::condition_impl::condition_impl(void)" (??0condition_impl@detail@boost@@QAE@XZ) referenced in function "public: __thisc
all boost::condition::condition(void)" (??0condition@boost@@QAE@XZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::detail::condition_impl::~condition_impl(void)" (??1condition_impl@detail@boost@@QAE@XZ) referenced in function "public: __this
call boost::condition::~condition(void)" (??1condition@boost@@QAE@XZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::detail::condition_impl::notify_one(void)" (?notify_one@condition_impl@detail@boost@@QAEXXZ) referenced in function "publi
c: void __thiscall boost::condition::notify_one(void)" (?notify_one@condition@boost@@QAEXXZ)
CvGame.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::mutex::do_lock(void)" (?do_lock@mutex@boost@@AAEXXZ) referenced in function "public: static void __cdecl boost::detail::
thread::lock_ops<class boost::mutex>::lock(class boost::mutex &)" (?lock@?$lock_ops@Vmutex@boost@@@thread@detail@boost@@SAXAAVmutex@4@@Z)
CvGame.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::mutex::do_unlock(void)" (?do_unlock@mutex@boost@@AAEXXZ) referenced in function "public: static void __cdecl boost::deta
il::thread::lock_ops<class boost::mutex>::unlock(class boost::mutex &)" (?unlock@?$lock_ops@Vmutex@boost@@@thread@detail@boost@@SAXAAVmutex@4@@Z)
CvGame.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::mutex::do_lock(void * &)" (?do_lock@mutex@boost@@AAEXAAPAX@Z) referenced in function "public: static void __cdecl boost:
:detail::thread::lock_ops<class boost::mutex>::lock(class boost::mutex &,void * &)" (?lock@?$lock_ops@Vmutex@boost@@@thread@detail@boost@@SAXAAVmutex@4@AAPAX@Z)
CvGame.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::mutex::do_unlock(void * &)" (?do_unlock@mutex@boost@@AAEXAAPAX@Z) referenced in function "public: static void __cdecl bo
ost::detail::thread::lock_ops<class boost::mutex>::unlock(class boost::mutex &,void * &)" (?unlock@?$lock_ops@Vmutex@boost@@@thread@detail@boost@@SAXAAVmutex@4@AAPAX@Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::mutex::~mutex(void)" (??1mutex@boost@@QAE@XZ) referenced in function "public: __thiscall Timer::~Timer(void)" (??1Timer@@QAE@X
Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::thread::~thread(void)" (??1thread@boost@@QAE@XZ) referenced in function "public: __thiscall Timer::~Timer(void)" (??1Timer@@QA
E@XZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::thread::join(void)" (?join@thread@boost@@QAEXXZ) referenced in function "public: __thiscall Timer::~Timer(void)" (??1Time
r@@QAE@XZ)
CvGame.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall boost::lock_error::~lock_error(void)" (??1lock_error@boost@@UAE@XZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::lock_error::lock_error(void)" (??0lock_error@boost@@QAE@XZ) referenced in function "public: void __thiscall boost::detail::thr
ead::scoped_lock<class boost::mutex>::lock(void)" (?lock@?$scoped_lock@Vmutex@boost@@@thread@detail@boost@@QAEXXZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall boost::thread_exception::~thread_exception(void)" (??1thread_exception@boost@@UAE@XZ) referenced in function "public: virtual
void * __thiscall boost::thread_exception::`scalar deleting destructor'(unsigned int)" (??_Gthread_exception@boost@@UAEPAXI@Z)
CvGame.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall boost::lock_error::what(void)const " (?what@lock_error@boost@@UBEPBDXZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: bool __thiscall boost::detail::condition_impl::do_timed_wait(struct boost::xtime const &)" (?do_timed_wait@condition_impl@detail@boost@@QAE_NABU
xtime@3@@Z) referenced in function "private: bool __thiscall boost::condition::do_timed_wait<class boost::mutex>(class boost::mutex &,struct boost::xtime const &)" (??$do_timed_wait@Vmutex@boost@@@condition@b
oost@@AAE_NAAVmutex@1@ABUxtime@1@@Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::detail::condition_impl::enter_wait(void)" (?enter_wait@condition_impl@detail@boost@@QAEXXZ) referenced in function "priva
te: bool __thiscall boost::condition::do_timed_wait<class boost::mutex>(class boost::mutex &,struct boost::xtime const &)" (??$do_timed_wait@Vmutex@boost@@@condition@boost@@AAE_NAAVmutex@1@ABUxtime@1@@Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::thread::thread(class boost::function0<void,class std::allocator<class boost::function_base> > const &)" (??0thread@boost@@QAE@
ABV?$function0@XV?$allocator@Vfunction_base@boost@@@std@@@1@@Z) referenced in function "public: __thiscall Timer::Timer(struct boost::xtime const &,class CvGame *)" (??0Timer@@QAE@ABUxtime@boost@@PAVCvGame@@@
Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::mutex::mutex(void)" (??0mutex@boost@@QAE@XZ) referenced in function "public: __thiscall Timer::Timer(struct boost::xtime const
&,class CvGame *)" (??0Timer@@QAE@ABUxtime@boost@@PAVCvGame@@@Z)
release/CvGameCoreDLL.dll : fatal error LNK1120: 19 unresolved externals
make: *** [GNUmakefile:104: release/CvGameCoreDLL.dll] Error 96
 
Tried it with the following result, but right now I don't have much time to analyse.

Creating library release/CvGameCoreDLL.lib and object release/CvGameCoreDLL.exp
CvGame.obj : error LNK2019: unresolved external symbol "int __cdecl boost::xtime_get(struct boost::xtime *,int)" (?xtime_get@boost@@YAHPAUxtime@1@H@Z) referenced in function "private: void __thiscall Timer::c
alc_next_time(void)" (?calc_next_time@Timer@@AAEXXZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::detail::condition_impl::condition_impl(void)" (??0condition_impl@detail@boost@@QAE@XZ) referenced in function "public: __thisc
all boost::condition::condition(void)" (??0condition@boost@@QAE@XZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::detail::condition_impl::~condition_impl(void)" (??1condition_impl@detail@boost@@QAE@XZ) referenced in function "public: __this
call boost::condition::~condition(void)" (??1condition@boost@@QAE@XZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::detail::condition_impl::notify_one(void)" (?notify_one@condition_impl@detail@boost@@QAEXXZ) referenced in function "publi
c: void __thiscall boost::condition::notify_one(void)" (?notify_one@condition@boost@@QAEXXZ)
CvGame.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::mutex::do_lock(void)" (?do_lock@mutex@boost@@AAEXXZ) referenced in function "public: static void __cdecl boost::detail::
thread::lock_ops<class boost::mutex>::lock(class boost::mutex &)" (?lock@?$lock_ops@Vmutex@boost@@@thread@detail@boost@@SAXAAVmutex@4@@Z)
CvGame.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::mutex::do_unlock(void)" (?do_unlock@mutex@boost@@AAEXXZ) referenced in function "public: static void __cdecl boost::deta
il::thread::lock_ops<class boost::mutex>::unlock(class boost::mutex &)" (?unlock@?$lock_ops@Vmutex@boost@@@thread@detail@boost@@SAXAAVmutex@4@@Z)
CvGame.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::mutex::do_lock(void * &)" (?do_lock@mutex@boost@@AAEXAAPAX@Z) referenced in function "public: static void __cdecl boost:
:detail::thread::lock_ops<class boost::mutex>::lock(class boost::mutex &,void * &)" (?lock@?$lock_ops@Vmutex@boost@@@thread@detail@boost@@SAXAAVmutex@4@AAPAX@Z)
CvGame.obj : error LNK2019: unresolved external symbol "private: void __thiscall boost::mutex::do_unlock(void * &)" (?do_unlock@mutex@boost@@AAEXAAPAX@Z) referenced in function "public: static void __cdecl bo
ost::detail::thread::lock_ops<class boost::mutex>::unlock(class boost::mutex &,void * &)" (?unlock@?$lock_ops@Vmutex@boost@@@thread@detail@boost@@SAXAAVmutex@4@AAPAX@Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::mutex::~mutex(void)" (??1mutex@boost@@QAE@XZ) referenced in function "public: __thiscall Timer::~Timer(void)" (??1Timer@@QAE@X
Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::thread::~thread(void)" (??1thread@boost@@QAE@XZ) referenced in function "public: __thiscall Timer::~Timer(void)" (??1Timer@@QA
E@XZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::thread::join(void)" (?join@thread@boost@@QAEXXZ) referenced in function "public: __thiscall Timer::~Timer(void)" (??1Time
r@@QAE@XZ)
CvGame.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall boost::lock_error::~lock_error(void)" (??1lock_error@boost@@UAE@XZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::lock_error::lock_error(void)" (??0lock_error@boost@@QAE@XZ) referenced in function "public: void __thiscall boost::detail::thr
ead::scoped_lock<class boost::mutex>::lock(void)" (?lock@?$scoped_lock@Vmutex@boost@@@thread@detail@boost@@QAEXXZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall boost::thread_exception::~thread_exception(void)" (??1thread_exception@boost@@UAE@XZ) referenced in function "public: virtual
void * __thiscall boost::thread_exception::`scalar deleting destructor'(unsigned int)" (??_Gthread_exception@boost@@UAEPAXI@Z)
CvGame.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall boost::lock_error::what(void)const " (?what@lock_error@boost@@UBEPBDXZ)
CvGame.obj : error LNK2019: unresolved external symbol "public: bool __thiscall boost::detail::condition_impl::do_timed_wait(struct boost::xtime const &)" (?do_timed_wait@condition_impl@detail@boost@@QAE_NABU
xtime@3@@Z) referenced in function "private: bool __thiscall boost::condition::do_timed_wait<class boost::mutex>(class boost::mutex &,struct boost::xtime const &)" (??$do_timed_wait@Vmutex@boost@@@condition@b
oost@@AAE_NAAVmutex@1@ABUxtime@1@@Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall boost::detail::condition_impl::enter_wait(void)" (?enter_wait@condition_impl@detail@boost@@QAEXXZ) referenced in function "priva
te: bool __thiscall boost::condition::do_timed_wait<class boost::mutex>(class boost::mutex &,struct boost::xtime const &)" (??$do_timed_wait@Vmutex@boost@@@condition@boost@@AAE_NAAVmutex@1@ABUxtime@1@@Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::thread::thread(class boost::function0<void,class std::allocator<class boost::function_base> > const &)" (??0thread@boost@@QAE@
ABV?$function0@XV?$allocator@Vfunction_base@boost@@@std@@@1@@Z) referenced in function "public: __thiscall Timer::Timer(struct boost::xtime const &,class CvGame *)" (??0Timer@@QAE@ABUxtime@boost@@PAVCvGame@@@
Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: __thiscall boost::mutex::mutex(void)" (??0mutex@boost@@QAE@XZ) referenced in function "public: __thiscall Timer::Timer(struct boost::xtime const
&,class CvGame *)" (??0Timer@@QAE@ABUxtime@boost@@PAVCvGame@@@Z)
release/CvGameCoreDLL.dll : fatal error LNK1120: 19 unresolved externals
make: *** [GNUmakefile:104: release/CvGameCoreDLL.dll] Error 96
Forget my last post. It has nothing to do with your changes. What I forgot to mention is that I already have my mod, which I previously developed on windows. This mod is partially based on Ramkhamhaeng's PBmod. The errors above are caused by some code from PBmod. After I removed those code sections the DLL compiled without an issue and the game is working with it.

Thanks a lot for the setup.
 
I inherited it from AdvCiv
I was wondering about that. AdvCiv is the only mod, which I know for a fact is using a def file. That's why I got a bit puzzled with that error and asked which mod was being compiled.

After I removed those code sections the DLL compiled without an issue and the game is working with it.
Congratulations [party]
It's such a nice feeling when you finally get a compiler to work after struggling with it for a while. Sure the real work starts now that you can develop your mod, but at least now each change is progress towards something better rather than "just getting it to work". That also makes the work a whole lot more fun.
 
Back
Top Bottom