Author Topic: switching between compilers?  (Read 5497 times)

Offline Joerg

  • Multiple posting newcomer
  • *
  • Posts: 100
switching between compilers?
« on: October 06, 2007, 07:46:24 pm »
Hi,
for my project I have to switch between MSVC++ 2005 and MingW.
I want to compile on different computers.
I I change to 'Microsoft Visual C++ 2005' in Project/Built Options
some things go wrong here.
The wxwidgets libs a still named libwx*.a instead wx*.lib.
Some defines are probably not correct for msc.
At least it's nearly impossible to change the toolchain
in an existing project.
Maybe its better to create a new one.
But than I need some hints to replace which files.
Regards,

It's never too late to fail!

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: switching between compilers?
« Reply #1 on: October 06, 2007, 07:54:02 pm »
I I change to 'Microsoft Visual C++ 2005' in Project/Built Options
some things go wrong here.

Changing compiler will not automagically change the related compiler options. In that case you need to create a separate project / target.

The best solution is to create a new target using wxWidgets wizard for MSVC compiler and add it to your existing project. Use File > New > Target after you open your project in C::B and then create a new target with a different compiler.
Be a part of the solution, not a part of the problem.

Offline Joerg

  • Multiple posting newcomer
  • *
  • Posts: 100
Re: switching between compilers?
« Reply #2 on: October 08, 2007, 11:37:17 am »
Hi,

I added a new taget with File/New/Build target for MSVC 2005.
Thats a lot better than before, but still I can't compile.
I got a million of warnings. It starts with:
Code
cl : Command line warning D9002 : ignoring unknown option '-pipe' simbimApp.cpp
cl : Command line warning D9002 : ignoring unknown option '-mthreads'
D:\wxWidgets\include\wx/chkconf.h(1824) : warning C4668: 'wxUSE_WX_RESOURCES' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
C:\Programme\Microsoft Visual Studio 8\VC\include\string.h(141) : warning C4619: #pragma warning : there is no warning number '4609'
D:\wxWidgets\include\wx/strconv.h(416) : warning C4820: 'wxCSConv' : '3' bytes padding added after data member 'wxCSConv::m_deferred'
C:\Programme\Microsoft Visual Studio 8\VC\include\wchar.h(116) : warning C4820: '_wfinddata64i32_t' : '4' bytes padding added after data member '_wfinddata64i32_t::attrib'
.......
And ends with an error:
Code
Linking executable: bin\DebugVC\icpsim.exe
LINK : fatal error LNK1181: cannot open input file 'libkernel32.a.lib'
Process terminated with status 1181 (0 minutes, 58 seconds)
1 errors, 1086 warnings

So there is still something wrong in the compiler settings.
But where?
 
It's never too late to fail!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: switching between compilers?
« Reply #3 on: October 08, 2007, 05:08:41 pm »
So there is still something wrong in the compiler settings.
But where?
Enable full command line logging (see my sig) and post the output again. Check "other" compiler and linker flags for e.g. the "-pipe" and consorts. If found -> remove them. These are GCC switches.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: switching between compilers?
« Reply #4 on: October 08, 2007, 05:56:20 pm »
So there is still something wrong in the compiler settings.
But where?

I believe you've discovered a bug in wxWidgets wizard. Few compiler setting are added at project level which means they will be applied to all the targets. They are compiler specific. In your case you started with GCC and then added MSVC target to it. Thus the options added in Project level (while preparing a project for MinGW) are still being used for the MSVC target which is causing this error.

At the moment I can't offer you any quick-fix solution for this. I think I need to rewrite a considerable portion of wxWidgets wizard to fix this. For the time being, I'd suggest you to create separate project for each compiler. :)
Be a part of the solution, not a part of the problem.