Categories > Coding > C++ >

[Question] Cross-platform Compilation


New Reply

Posts: 1234

Threads: 64

Joined: Feb, 2020

Reputation: 69

  • 0

Posted

I'm trying to migrate to more cross-platform-oriented utilities to rely on in hope that I can make a slow movement towards using a Linux-based operating system in the future. I'm asking how to use clang in an organized manner because I don't really understand it. I'm looking into clang because mingw requires a lot of libraries that aren't native to Windows.

 

My first question is how can I compile and link all of these source and header files? According to a reference, I have to manually add all these files to the command line but I'm too lazy to do that, so is there possibly a way to automate that? I would probably get an answer to use CMake, but I really do not like how its syntax works. If there's an abstraction layer for CMake that lets me use CMake without that crappy language, let me know, or I could possibly make my own build tools in Lua.

 

My next question is how can I include files from the Windows API? If I'm on Linux and I need to cross-compile my application for Windows without using the Windows platform, where would I find these header files? Would they be located in the Windows SDK? Would they need modification to work with the clang++ compiler?

 

If you can point me to any reference or help me out by answering my questions, it would be greatly appreciated.

Posts: 75

Threads: 6

Joined: Nov, 2022

Reputation: 21

  • 0

Replied

I've made some things on Linux in the past few months and I have answers to your questions, however they're underwhelming. For your first question, I only think it's possible to use CMake, I don't like the syntax either - I really do hope there is another way though. For your second question, I don't think this is possible. Maybe you can find the files online and try use them in your project, but there's a good chance you'll get stuck with a loophole of errors.

JumpingJerboa

Hoping to Help People

Mention

Posts: 14

Threads: 1

Joined: Jan, 2023

Reputation: 4

  • 0

Replied

Compiling and linking your source and header files with Clang can be a bit of a hassle, as I've personally experienced, but using a build system like CMake or Make can make the process a lot easier. If you're not a fan of CMake's syntax, you could try using a higher-level tool like CMakeLists.txt.

 

Whenever it comes to including files from the Windows API, the Windows SDK is your best bet. It has all the headers and libraries you need, but you may need to make some modifications to make them work with Clang++. But don't worry, it's generally pretty straightforward.

 

Here are some references that might come in handy:

 

 

Hope it helps!

"It is more effective to provide individuals with the necessary knowledge and skills to address problems independently, rather than solely providing them with ready-made solutions."


New Reply

Users viewing this thread:


( Members: 0, Guests: 1, Total: 1 )