User forums > Using Code::Blocks

Same project under Linux and Windows?

<< < (2/2)

Sephiroth:
I know that Qt is cross-platform, which is why I chose it. Not sure what the point of MSYS2 is since I run Gentoo on my Linux boxes. I did not consider Git for some reason. I just did not think about it. I will likely use it now, but what about Qt Creator? I want to code using Code::Blocks but how do I make that mesh with Qt Creator?

See the UI I want to be cross-platform. 90% of this project will be pure C++ code however, and will work fine on any standard system, even Apple. I do not want separate projects due to 90% or more being identical on all platforms. It doesn't make sense to me. My idea was to have a Windows folder with the Windows-only code, a Linux folder with Linux-only code, and a Common folder with the code that does all the work. Why is this not a good idea or why can't I do it this way?

LETARTARE:
Hello,
I do not respond directly to your questioning, but I give you my experience with 'Qt' and 'Code::Blocks'.
As you, I develop the same application under Win64, Win32 and Linux (OpenSuse : Leap-15.2) : https://github.com/letartare/gcv .
Also I created a plugin for 'Code::Blocks':
http://forums.codeblocks.org/index.php/topic,20000.0.html) and https://github.com/letartare/cb_addonforqt  
that using multiple files 'xxx.cbp' allows to manage the construction of the different binary under Window or Linux (xxx_win32.cbp, xxx_win64.cbp, xxx_lin64.cbp).
The creation of  '*.ui' files is carried out by 'QtDesigner'.
Creating translation is done by scripting files that calls 'Qt' tools.
These calls are driven from the 'Tools' menu of 'Code: Blocks'.

Have a good day.


Smitty:
I recommend that you rely upon CMake instead of CodeBlocks for project management.

CodeBlocks is great for a single platform target, but, if you are serious about cross platofrm development, you need a tool which is designed to handle that, which is CMake.  The great thing is that CMake can use the CodeBlocks generators to allow you to work on your project from either Windwos or Linux (or other supported platforms).

cacb:

--- Quote from: BlueHazzard on March 18, 2021, 05:48:59 pm ---The general idea is to create a target per platform:
Project->Properties->Build targets->Platform
ecc...

If you have the same source libraries, you can use global variables to differentiate between your windows and linux machine
http://wiki.codeblocks.org/index.php/Global_compiler_variables

--- End quote ---

Yes, I routinely do this. It works fine. I even do it with MSVC on Windows and gcc on linux. Same project file, different build targets.

Navigation

[0] Message Index

[*] Previous page

Go to full version