Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Compiling Code::Blocks with the MS compiler
280Z28:
The compiler with VS 2005 is one of the most compliant compilers available.
Functions were deprecated primarily for two reasons:
1) Known insecurities. Obvious reason to deprecate. If you don't feel like changing these, define the following directive:
#define _CRT_SECURE_NO_DEPRECATE
2) Non-standard items. Things that were never in the C++ standard to start with have been deprecated. Turn these off:
#define _CRT_NONSTDC_NO_DEPRECATE
280Z28:
I got all the plugins from the main project working in it :)
killerbot:
always use more compilers to compile you code (if possible)
how about turning those c files into c++, so the c++ compiler treats them as c++ and not as c (in case of the same compiler), more over c is subset of c++ ??
[EDIT] It would indeeed by nice to have CB and plug-ins compilable with different compilers, but stick to the standards, so if we use C, don't screw it up for M$-s sake. Make C++ out of it, I know Thomas once wrote here a good reason, to have them as C, don't remember the argument anymore.
takeshimiya:
--- Quote from: 280Z28 on January 22, 2006, 09:57:30 am ---I got all the plugins from the main project working in it :)
--- End quote ---
So that means it works everything just like with GCC?
I wonder if compiling with DMars would work. You know, having C::B to compile exactly 20 times faster than GCC is not something minor. :D
Der Meister:
I just compiled Code::Blocks revision 1828 with the Linux version of icc 9.0 and it seems to work well. Just a few changes were necessary:
First one for AngelScript:
--- Code: ---Index: src/sdk/as/source/as_scriptengine.cpp
===================================================================
--- src/sdk/as/source/as_scriptengine.cpp (revision 1828)
+++ src/sdk/as/source/as_scriptengine.cpp (working copy)
@@ -2236,7 +2236,7 @@
}
else if( i->callConv == ICC_STDCALL )
{
- void (STDCALL *f)(void *, void *) = (void (STDCALL *)(void *, void *))(i->func);
+ void (STDCALL *f)(void *, void *) = (void (/*STDCALL*/ *)(void *, void *))(i->func);
f(param1, param2);
}
else
--- End code ---
I'm sure if this still works - but without this change icc produces weired error messages. Probably because it seems to behave as GCC and has __GNUC__ makros (or something similar) defined and STDCALL is therefore expandet to __attribute(stdcall) (or something similar) and icc doesn't undertand this.
The next patch is for keybinder:
--- Code: ---Index: src/plugins/contrib/keybinder/keybinder.cpp
===================================================================
--- src/plugins/contrib/keybinder/keybinder.cpp (revision 1828)
+++ src/plugins/contrib/keybinder/keybinder.cpp (working copy)
@@ -1421,7 +1421,7 @@
// use a combobox + a listbox
m_pCommandsList = new wxListBox(this, wxKEYBINDER_COMMANDS_BOX_ID, wxDefaultPosition,
- wxDefaultSize, 0, NULL);
+ wxDefaultSize, 0, 0);
m_pCategories = new wxComboBox(this, wxKEYBINDER_CATEGORIES_ID,
wxEmptyString, wxDefaultPosition, wxDefaultSize,
0, NULL, wxCB_READONLY);
--- End code ---
That's because in C++ 0 should be used instead of NULL for a zero-pointer. With NULL icc complains about two constructors that are matching to the current call.
And the last one is for the profiler-plugin:
--- Code: ---Index: src/plugins/contrib/profiler/cbprofiler.cpp
===================================================================
--- src/plugins/contrib/profiler/cbprofiler.cpp (revision 1828)
+++ src/plugins/contrib/profiler/cbprofiler.cpp (working copy)
@@ -85,11 +85,12 @@
if (project->GetBuildTargetsCount() > 1)
{
// more than one executable target? ask...
- wxString choices[project->GetBuildTargetsCount()];
+ wxString* choices = new wxString[project->GetBuildTargetsCount()];
for (int i=0; i<project->GetBuildTargetsCount(); i++)
choices[i] = project->GetBuildTarget(i)->GetTitle();
wxSingleChoiceDialog dialog(Manager::Get()->GetAppWindow(),_("Select the target you want to profile"),
_("Select Target"),project->GetBuildTargetsCount(),choices);
+ delete[] choices;
dialog.SetSelection(0);
if (dialog.ShowModal() != wxID_OK)
return -1;
--- End code ---
It seems as if there were arrays with a variable length used. But this is a feature of C99 and *not* C++98. New gcc versions seem to support this for C++, too, but it is not correct.
Another thing is: I used the linux build system. Switching to icc is quite easy, just add CXX=icc CC=icc when invoking the configure-script. But icc doens't understand the same commands for building precomipled headers as the gcc. This means that precomipled headers must be disabled or the flags must be changed to make word with icc, too (anyway, I wasn't able to do this). But adding --enable-pch=no to the configure-call doens't work - configure fails with an error message:
--- Quote ---configure: Configuring Code::Blocks...
configure: error: conditional "PRECOMPILE_HEADERS" was never defined.
Usually this means the macro was only invoked conditionally.
--- End quote ---
Thus i had to remove the parts for precompiled headers manually from 'src/sdk/Makefile.am' and 'src/plugins/contrib/wxsmith/Makefile.am'.
But then it works, icc just shows a few warnings about parameters it doesn't understand, like '--fast-math'.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version