User forums > Using Code::Blocks
Problem creating same output as VS 2005
yamokosk:
Ok, I did a lot of testing and discovered two things: one possible bug in C::B and the other is a major difference in the tool paths between C::B and VS.
First the possible bug. After thoroughly scouring the build logs of both VS and C::B, I found that the link option "/DEBUG" was present in VS but not in C::B. To try and fix this, I went to C::B->Build Options->Link Settings->Other linker options and added /DEBUG. But whenever I hit "Ok" and recompiled, the "/DEBUG" option did not show up. In fact when I went back to the build options page, what I had entered disappeared?! Maybe this has already been reported? Anways, as a quick fix, I went to Settings->Compiler and debugger...->Other settings->Advanced options... and essentially hardcoded "/DEBUG" into the "Link object files to dynamic library" command. After the fix, what do you know.. The dumpbin for both the C::B compiled library and the C::B compiled mex file were identical!
But that still did not completely fix my problems. I am not a C++/Windows/VS guru but what is a manifest? This seems to be where the C::B tool path differs significantly from VS. More specifically, when I instruct VS to not "Embed the Manifest", I get the same bad mex file produced by C::B (aka Matlab gives the same error message for both mex files). But when I embed the manifest in VS, I get a working mex file.
Also one other observation. VS allows options to be specified for the resource compiler tool. Is this functionality in the works for a future release of C::B? What about this manifest thing?
Biplab:
The problem is wizard doesn't setup a Post-build Job to embed manifests. I believe this is the root cause.
MSVC 8 (MSVC 2005) requires a special manifest file (An XML file) to load debug CRT. As you're compiling DLL in debug mode, it needs that manifest file either in embedded form or in the same directory where your DLL resides.
I'm updating the wizard so that a post-build job gets executed to embed the manifest file.
--- Quote from: yamokosk on June 22, 2007, 01:11:23 am ---First the possible bug. After thoroughly scouring the build logs of both VS and C::B, I found that the link option "/DEBUG" was present in VS but not in C::B. To try and fix this, I went to C::B->Build Options->Link Settings->Other linker options and added /DEBUG. But whenever I hit "Ok" and recompiled, the "/DEBUG" option did not show up. In fact when I went back to the build options page, what I had entered disappeared?! Maybe this has already been reported? Anways, as a quick fix, I went to Settings->Compiler and debugger...->Other settings->Advanced options... and essentially hardcoded "/DEBUG" into the "Link object files to dynamic library" command. After the fix, what do you know.. The dumpbin for both the C::B compiled library and the C::B compiled mex file were identical!
--- End quote ---
This is the full commandline which C::B generates and it has /DEBUG directive.
--- Code: ---link.exe /dll /nologo /LIBPATH:"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\lib" /out:bin\Debug\TestDLL.dll user32.lib obj\Debug\main.obj /DEBUG
--- End code ---
MortenMacFly:
--- Quote from: yamokosk on June 22, 2007, 01:11:23 am ---I went to C::B->Build Options->Link Settings->Other linker options and added /DEBUG. But whenever I hit "Ok" and recompiled, the "/DEBUG" option did not show up.
--- End quote ---
Sure not. If you enter such option by hand that is part of the "official" list of compiler/linker settings it will be "transferred" into the appropriate checkbox being activated. It works like that:
- parse the list of compiler/linker options
- if it's found in the "official" list -> activate the appropriate checkbox
- if it cannot be found add it to the text field "just as it is"
So in your case if you added "/DEBUG" by hand int he text field next time you enter the dialog the appropriate checkbox is activated -> the settings do not get lost.
With regards, Morten.
Biplab:
The updated wizard is in Rev 4153. So wait for todays (or tonight's ;) ) nightly. It should solve your problem.
Please note that in the new wizard, incremental linking is set to NO. This is necessary to embed the manifest in a simple way.
yamokosk:
--- Quote ---The updated wizard is in Rev 4153.
--- End quote ---
Great! I will give the new build a test run when it comes out.
--- Quote ---So in your case if you added "/DEBUG" by hand int he text field next time you enter the dialog the appropriate checkbox is activated -> the settings do not get lost.
--- End quote ---
--- Quote ---This is the full commandline which C::B generates and it has /DEBUG directive.
--- End quote ---
Maybe I overlooked something but I am almost positive that the full command line that C::B generated did not have the /DEBUG option in it. That was after adding it to the extra options list about 3 or 4 times... but if you say its there, then maybe it was a user error. Morten - Thanks for the explanation of the disappearing options. I had a feeling something like that was going on behind the scenes because I witnessed similar behavior for other options.
--- Quote ---Please note that in the new wizard, incremental linking is set to NO. This is necessary to embed the manifest in a simple way.
--- End quote ---
This is no problem for my project. I toggled this option in VS and Matlab didn't seem to care either way.. which makes sense I guess.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version