Jump to content

  • Log In with Google      Sign In   
  • Create Account


vsc++:soil.lib linking problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 nickme   Members   -  Reputation: 205

Like
0Likes
Like

Posted 19 December 2012 - 12:23 AM

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.

Sponsor:

#2 sgt_barnes   Members   -  Reputation: 585

Like
0Likes
Like

Posted 19 December 2012 - 03:43 AM

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.

#3 BitMaster   Crossbones+   -  Reputation: 3792

Like
1Likes
Like

Posted 19 December 2012 - 03:56 AM

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 :


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 statically 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.

#4 sgt_barnes   Members   -  Reputation: 585

Like
0Likes
Like

Posted 19 December 2012 - 05:56 AM

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).


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.

#5 nickme   Members   -  Reputation: 205

Like
0Likes
Like

Posted 19 December 2012 - 12:38 PM

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.


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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS