Day 59/100 100 Days of Code

Learning

I started watching a video about cross-compiling with Clang. I started working on the Windows side of the game and found out that the linker option is located in the project, NOT in the solution file, which some have posted on various forums. Also, learned how to fix an error that might appear suddenly in Powershell.

I discovered what was wrong with the help of a Stack Overflow post.

I might be able to complete the build with CMake now.

Linker option location

Some forum posts suggested searching for the linker option in the solution file. But it is not located there, the option is in the project file.

Solution's Properties Page

Project Properties Page

Cross Compiling

I learned how it works using the command line. I learned how to start a build targeting windows but it was unable to find the iostream library. So, I included the path to the libraries in the build command:

test.cpp -o test.exe 
-target x86_64-pc-windows-gnu 
-I/usr/local/Cellar/mingw-w64/11.0.1/toolchain-x86_64/x86_64-w64-mingw32/include/c++/13.2.0 
-I/usr/local/Cellar/mingw-w64/11.0.1/toolchain-x86_64/x86_64-w64-mingw32/include/c++/13.2.0/x86_64-w64-mingw32 
-I/usr/local/Cellar/mingw-w64/11.0.1/toolchain-x86_64/x86_64-w64-mingw32/include/c++/13.2.0/tr1

This fixed the iostream library missing issue but I got the following error multiple times:

 no member named ' ' in the global namespace

The content in the single quotes is the member that the compiler was unable to find. I think the problem is that I do not have the .dll files of the libraries. Getting them from the Windows Virtual Machine won't be hard.

Cross compiling with third party libraries

This might mean that I also need to build the libraries for the target operating system which is going to be very annoying to do. Is cross compiling to another operating a long and tedious process?

Powershell's not recognised or not found error

The command a.exe was not found, 
but does exist in the current location. 
Windows PowerShell doesn't load commands from 
the current location by default. 
If you trust this command, instead type ".\a.exe".

# Or 

attrib : The term 'attrib' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\chris\scoop\apps\scoop\current\libexec\scoop-uninstall.ps1:118 char:9
+         attrib $currentDir -R /L
+         ~~~~~~
    + CategoryInfo          : ObjectNotFound: (attrib:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Installing packages broke something in Powershell and started getting the not recognised error which stopped scoop from doing its job. I could not even reinstall scoop!

I managed to fix it by using the following command that I found on stack overflow.

The problem was fixed with the following command:

$env:PATH =$env:PATH+";."

The command has to be executed everytime the OS restarts though.

Clang and LLVM Talk