Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Debug Libraries issue

Author
Message
m0ng00se
16
Years of Service
User Offline
Joined: 2nd Dec 2007
Location:
Posted: 23rd Dec 2007 23:46
When I combine my AI code with my GDK stuff I get 30 linker errors because GDK excludes libcmtd.lib by default but my AI code has objects defined in libcmtd. Example:




Well I think that is what is going on anyway. If I don't exclude libcmtd I get 9 linker errors as follows:



My understanding is that I'm trying to use both debug and release versions of the same library. At least that's what I think I learned when I googled the error message. It didn't tell me how to fix the problem though. If I run release version instead of debug then I get no linker errors at all but that's no use to me because I need to be able to debug as I keep adding more code over the next few months.

Any suggestions:

m0ng00se
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 28th Dec 2007 13:38
In these cases it is easiest to do this:

1) In project settings | Linker | Input set the "Ignore default libraries" option to Yes (equivalent to /NODEFAULTLIB linker option), which disables linking of all runtime libraries

2) Choose wich particular library(ies) you need and add them manually in the same configuration tab under "Additional dependencies" option

To select the appropriate library for your project, you need to know in which library the missing symbol is located. That depends on your compiler properties (whether static or dynamic linking is applied, debug/release build or single/multi-threaded usage). Check out the C/C++|Code Generation|Runtime Library project setting.
Woozl
16
Years of Service
User Offline
Joined: 21st Dec 2007
Location:
Posted: 28th Dec 2007 14:33
Hello m0ng00se,

I had this same problem when combining two projects into the same Solution.

I was able to resolve the issue by setting both projects to compile with the same runtime libraries, and clear out the ignored libraries completely.

To do this:

1)
Right click on each project in the solution browser the select properties>c++>Code Generation.
The 6th item down (on the right side) is called "Runtime Library".

By clicking in the text area, you are able to choose your build target from a pulldown menu.

Whichever you decide on, whether it is "Multi Threaded (/MT)", "Multi Threaded Debug (/MTd)", or one of the other choices, just make sure you choose the same for all projects in your solution.

2)
While you have the properties dialog open for each project, also go to the linker option on the left side, expand it and click on the "Input" selection.

On the right side find the text entry area for "Ignore Specific Library" and clear the field. (might want to make a note of what was in each in case you need to restore them later)

As I said, this fixed the problem for me, so you might give it a go.

Hope it helps!

Regards,
Woozl
Miguel Melo
19
Years of Service
User Offline
Joined: 8th Aug 2005
Location:
Posted: 29th Dec 2007 16:42
Of course, conversely and since we don't have access to the GDK source code, TGC could release a debug version of the LIB files for us to link with when doing debug builds.

I have vague plans for World Domination
tempicek
16
Years of Service
User Offline
Joined: 27th Nov 2007
Location: Prague
Posted: 29th Dec 2007 17:19
Quote: "I was able to resolve the issue by setting both projects to compile with the same runtime libraries, and clear out the ignored libraries completely."


If those projects are dependent (say one is a static or dynamic library and the second one is executable using the first one), you should definitely make both compile with the same configuration regarding "code generation" (especially if you don't know much about these settings).

If those projects are independent (separate executables), their configurations may vary. A configuration of one of them doesn't affect the other one. Finally, they are independent, right?

Quote: "On the right side find the text entry area for "Ignore Specific Library" and clear the field."


By clearing this field, m0ng00se obtained the "already defined" linker errors. This is why it is important to exclude particular libraries from linking.


General rule says - don't touch it if you don't know what it does, because you can screw things up and even if it seems working now, it can catch you later. You can find a lot of reading about the runtime libraries on MSDN.
Pixel Perfect
17
Years of Service
User Offline
Joined: 21st Feb 2007
Location: UK
Posted: 29th Dec 2007 18:57
I couldn't agree more with you Miguel:

Quote: "TGC could release a debug version of the LIB files for us to link with when doing debug builds"


No matter how good your code is, someone will improve on it
m0ng00se
16
Years of Service
User Offline
Joined: 2nd Dec 2007
Location:
Posted: 3rd Jan 2008 04:19
Thnx guys, just got back from a Xmas break where I had no internet so about to test those solutions you provided now.

They were previously seperate executables in answer to that question but only for testing purposes until I was ready to combine the code. One is my GDK animation and the other is text based interactive AI code. Both worked fine as seperate projects.

m0ng00se (NZ)

Login to post a reply

Server time is: 2024-09-29 09:17:44
Your offset time is: 2024-09-29 09:17:44