User forums > General (but related to Code::Blocks)

create Project for Windows and Linux

(1/2) > >>

new-c::b-user:
Hi everybody,

i'm quite new to codeblocks and i installed codeblocks (nightly) on windows without any problems. I also installed it on Ubuntu 7.04 successfully. I created a new wxwidget project under windows and this runs fine there. Now i wanted to use this project in linux too and setted up a svn for this.

But the project won't compile because of '-mthreads' is a typical MinGW option :-)
So my question is: What must i do to have a real cross OS project?
The next question is how to handle the compiler and linker options?
In Windows i linked against C:\Programme\wxWidgets-2.8.4\lib\gcc_dll\libwxmsw28u.a
And how to handle the windows resource? Ok maybe this can be handled via wxresources ...

I searched the forum and wiki, but found nothing about it.
Can anybody give me some hints about this topic?

TIA

mariocup:
Hi,

one solution is to have to build targets for windows and linux, or you may attach a script to a build target and test the operating system to switch between different settings.

Biplab:

--- Quote from: new-c::b-user on September 14, 2007, 01:08:03 pm ---i'm quite new to codeblocks and i installed codeblocks (nightly) on windows without any problems. I also installed it on Ubuntu 7.04 successfully. I created a new wxwidget project under windows and this runs fine there. Now i wanted to use this project in linux too and setted up a svn for this.

--- End quote ---

Create a blank wxWidgets project on Linux. Then add your sources to the project. You'll need to maintain two project files for your project. You can't use your Windows project file on Linux.

Jenna:
There's no problem to use the same code and project files if you leave the OS specific settings under Build options ...empty.

You only have to use the same compiler(-name) under linux and windows and set the directories executables and so on under Settings -> Compiler and debugger.

If you need project specific settings you don't want to use for your any of the standard compilers you can create a special compiler there.

I tried it and it works fine. At least for me. It even works if change the OS and build without cleaning.

Of course you can also cross-compile and build win-executables under linux without the need to change to Win  :D.

mariocup:
Hi,

you may use something like that in the linker options or pre/postbuild steps:

[[ if (PLATFORM ==  PLATFORM_MSW) { print (_T("cmd /c")); } else { print (_T("sh ")); } ]] <command>

Navigation

[0] Message Index

[#] Next page

Go to full version