Add build instructions, comment broken code.

This commit is contained in:
kelson8 2024-11-12 00:17:33 -05:00
parent 3a02662713
commit c619a88a70
Signed by: kelson8
GPG Key ID: 3D738D9DD7239E13
3 changed files with 40 additions and 14 deletions

View File

@ -19,6 +19,30 @@
#include "stdbool.h"
// To setup this project on windows
// 1. Install CMake
// 2. Install Ninja with winget in windows 11: "winget install --id=Ninja-build.Ninja -e"
// 3. Make a build directory in this project and cd into it
// 4. Run this CMake command: "cmake -GNinja .."
// 5. Change into Debug/Release folder
// 6. Run this command to build: "cmake --build .. --config Debug"
// https://phoenixnap.com/kb/install-gcc-windows
// https://stackoverflow.com/questions/36770716/mingw64-make-build-error-bash-make-command-not-found
// To build without installing Visual Studio:
// 1. Download MingW64 from here: https://winlibs.com/#download-release
// 2. Place the folder into C:\
// 3. Add this folder to the path: "C:\mingw64\bin"
// 4. Download Make without guile from here: https://sourceforge.net/projects/ezwinports/files/
// 5. Copy files from make into "C:\mingw64", do not replace existing files!
// 6. Create a build folder and cd into it
// 7. Run this CMake command to generate build files: "cmake -G "MinGW Makefiles" .."
// 8. To build Run "make"
// TODO Look into getting current directory in Windows and Linux
// https://stackoverflow.com/questions/27585930/get-the-current-working-directory-in-c-on-windows
// TODO Move this into a different project.
#ifdef _WIN32
@ -77,7 +101,7 @@ int main() {
// }
// check_even_odd(1);
// new_struct();
// print_struct();
read_file("test.txt");

View File

@ -7,16 +7,17 @@
// https://www.w3schools.com/c/c_structs.php
void new_struct() {
struct structT1_ s1;
// Causes make error by using MinGW on the laptop..
// void new_struct() {
// struct structT1_ s1;
strcpy(structT1.username, "user");
structT1.tag_number = 22;
// s1.username = "user";
// s1.tag_number = 22;
// strcpy(structT1.username, "user");
// structT1.tag_number = 22;
// // s1.username = "user";
// // s1.tag_number = 22;
printf("Username: %s\nTag number: %i", structT1.username, structT1.tag_number);
}
// printf("Username: %s\nTag number: %i", structT1.username, structT1.tag_number);
// }
void print_struct(){
struct TestStruct s1;

View File

@ -8,11 +8,12 @@ struct TestStruct {
int age;
};
struct structT1_ {
char username[20];
int tag_number;
// Causes make error by using MinGW on the laptop..
// struct structT1_ {
// char username[20];
// int tag_number;
} structT1;
// } structT1;
// Not sure how to use this
#ifdef _TEST
@ -31,4 +32,4 @@ char *addr, char*bd, char sex);
#endif //_TEST
void print_struct();
void new_struct();
// void new_struct();