• Advertisement
Sign in to follow this  

vsc++:soil.lib linking problem

This topic is 1857 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi

my previous program ran just fine, including the soil lib. but after i modified the program from pop to oop, i got the following errors.

1>------ Build started: Project: Fractals with zoom, Configuration: Release Win32 ------
1> Utilities.cpp
1>Utilities.cpp(124): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234) : see declaration of 'fopen'
1>Soil.lib(SOIL.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Fractals with Zoom.obj : error LNK2001: unresolved external symbol "void __cdecl debug(void)" (?debug@@YAXXZ)
1>C:\Users\rob\DevC++ source\MSVC++\freeglut\fractal\Dynamical system and fractals\Fractals with Zoom\Release\Fractals with zoom.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

any help will be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
I'm not familiar with soil.lib, but you clearly miss a dependency for a function call probably looking similar to "debug ();" in file probably called "Fractals with Zoom.cpp".

My guess is that the named function only exists in debug mode (which makes sense, given the name ;-) ). Does it link in debug mode?

If so, following these steps to resolve the issue:

1) Open "Fractals with Zoom.cpp" ind Visual Studio
2) Switch to Debug|Win32 configuration
3) Find the call to "debug();"
4) wrap the function call like this:
[source lang="cpp"]#ifdef _DEBUG
debug ();
#endif
[/source]
IIRC, Visual C++ defines _DEBUG by default in Debug configurations, so you should be able to use it. If , however, you undefined this for some reason, use whatever you defined in its place.

Hope that helped.

Share this post


Link to post
Share on other sites
[quote name='nickme' timestamp='1355898183' post='5012349']1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Fractals with Zoom.obj : error LNK2001: unresolved external symbol "void __cdecl debug(void)" (?debug@@YAXXZ)
1>C:\Users\rob\DevC++ source\MSVC++\freeglut\fractal\Dynamical system and fractals\Fractals with Zoom\Release\Fractals with zoom.exe :
[/quote]

While the missing debug() is indeed a problem, a more serious problem is the warning about MSVCRTD. Either you are mixing Debug and Release runtimes or you are mixing /MT and /MD builds. While it is indeed possible to use /NODEFAULTLIB to suppress the warning, this will not be enough in most cases and the program will crash (either persistently or weirdly and infrequently).
When [b]statically[/b] linking C++ code together you must ensure the participating code was generated with compatible settings. In case of MSVC, one of the most frequent candidates for such incompatibility are the /MT, /MTd, /MD and /MDd switches, which is usually visible by the generation of a LNK4098.

Share this post


Link to post
Share on other sites
[quote name='BitMaster' timestamp='1355911007' post='5012387']
While the missing debug() is indeed a problem, a more serious problem is the warning about MSVCRTD. Either you are mixing Debug and Release runtimes or you are mixing /MT and /MD builds. While it is indeed possible to use /NODEFAULTLIB to suppress the warning, this will not be enough in most cases and the program will crash (either persistently or weirdly and infrequently).
[/quote]

Hm, yes, I concur. But I think this warning will go away once the error is fixed, because it might well be something connected with the objectionable function that drags in the debug runtime. Either that, or the problem is simply that "Fractals with Zoom.obj" IS in fact the object file compiled in debug mode... Maybe no proper cleanup? But how you would provoke such behavior is beyond me...

But now that I thought that through once again, this seems even more probable.

Share this post


Link to post
Share on other sites
[quote name='sgt_barnes' timestamp='1355910184' post='5012382']
I'm not familiar with soil.lib, but you clearly miss a dependency for a function call probably looking similar to "debug ();" in file probably called "Fractals with Zoom.cpp".

My guess is that the named function only exists in debug mode (which makes sense, given the name ;-) ). Does it link in debug mode?

If so, following these steps to resolve the issue:

1) Open "Fractals with Zoom.cpp" ind Visual Studio
2) Switch to Debug|Win32 configuration
3) Find the call to "debug();"
4) wrap the function call like this:
[source lang="cpp"]#ifdef _DEBUG
debug ();
#endif
[/source]
IIRC, Visual C++ defines _DEBUG by default in Debug configurations, so you should be able to use it. If , however, you undefined this for some reason, use whatever you defined in its place.

Hope that helped.
[/quote]

what happened was that i previously have a funciton called debug(), and i deleted it implementation but did not the calling. the compiler did not generate a unidentifier error but must had tried to call other system debug() method. after i deleted all the debug(), it ran just fine now.

thank you all.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement