All Questions
344 questions
1
vote
0
answers
43
views
How can I make GHashTable work with 64-bit hash?
I approached a problem when I tried to use XXH3_64bit from <xxhash.h> module over the wrapper with __fastcall for GHashTable initialization, but the type definition for GHashFunc requires the ...
0
votes
1
answer
87
views
printf() prints only the first character
Recently I came across an example from the book "The C Programming Language" and decided to run it:
#include <stdio.h>
#define IN 1
#define OUT 0
int main() {
int c, nl, nw, nc, ...
0
votes
1
answer
69
views
C:\Users\DELL\AppData\Local\Temp\cctSSakm.o:test.c:(.text+0x1e): undefined reference to `get_string' collect2.exe: error: ld returned 1 exit status
I see the error
c:\Users\DELL\AppData\Local\Temp\cc61L1BV.o:test.c:(.text+0x1e): undefined reference to `get_string'
collect2.exe: error: ld returned 1 exit status
C
#include <stdio.h>
#include ...
0
votes
0
answers
36
views
How can I declare a pointer to a constant struct literal that uses a flexible array in C if possible? [duplicate]
So I wanted to store some constant text and data for parts of a level in a game in a struct, then put pointers for all those structs in a struct for each level, and pointers for all the level structs ...
1
vote
2
answers
313
views
Problems of linking Ws2_32.lib using gcc
I thought that when I install gcc and mingw that crucial windows libraries are already imported with that. Apperantly not. Now how do I give the gcc linker the required libraries so that it can link ...
0
votes
1
answer
52
views
C connection to mysql gcc linker error in windows
I am using c in Windows. I need to use mysql.
I am having a really hard time trying to compile c code with mysql in it on Windows 11 os.
I had it easy in linux where I just needed to run either of the ...
2
votes
1
answer
109
views
Handling C2016 error on Windows using Visual Studio Code
I have to use someone else's C header files, which include empty structs. I have no control over these headers or I would change them as empty structs are not conventional C. The structs are throwing ...
0
votes
0
answers
102
views
cs50.h in windows gcc guide
Can anyone help me to include cs50.h in VS code. I have windows but there is no option for Windows. I have searched so much but couldn't find anything. Can anyone please guide me from zero to install ...
2
votes
0
answers
85
views
Installing libpng gets error: C compiler cannot create executables
I'm currently trying to install pokefirered for ROM-Hacking following the INSTALL.md file in the repository. I've already install devKitPro and msys2 and am currently trying to install libpng. I ran ...
0
votes
2
answers
50
views
Get unicode character on the screen ncurses
I'm facing a problem with getting a U+2588 █ character from the screen by using the winch().
Let's assume I have a window called win and it looks like this:
###████###
I want to redraw all # ...
2
votes
1
answer
125
views
C: gcc returns "multiple definition of" error but msvc - doesn't
Here I have a small program:
// header.h
#pragma once
int a;
int reta();
// extra.c
#include "header.h"
int reta() {
return a;
}
// main.c
#include "header.h"
#include <...
0
votes
0
answers
46
views
Linking libcurl on Windows Mingw32 returning Undefined References
I'm trying to link libcurl.a (I downloaded this from https://curl.se/windows/ for 32-bit Windows Machines and directly grabbed the static .a file). However, when I attempt to do so, I get the ...
0
votes
2
answers
129
views
Compiling C file with MingW in Windows: The system cannot execute the specified program
The C file compiles perfectly fine as long as it's only:
#include <stdio.h>
int main( void ) {
printf( "Hello, world without a new line" );
return 0;
}
and it outputs "...
1
vote
1
answer
90
views
C display tansparent text on any background
I want to show the GPU and CPU usage/temperature on the right upper corner as text on every opened window, like desktop, explorer, internet browser,...
My problem is, I can display the text only with ...
0
votes
0
answers
44
views
Linux vs W11 String handling (keyboard/file) fgets/scanf
TERMINAL INPUT
char Buffer[50];
printf("Give a word to search: ");
fgets(lineBuffer, 50, stdin);
Buffer[strlen(Buffer)-1] = '\0';
//scanf("%s", Buffer); <----- i also ...
0
votes
0
answers
105
views
fatal error: gtk/gtk.h: No such file or directory despite the GTK library being installed on my windows system
I followed the msys2 installation shown on the GTK website in order to code in C on my windows11 system.
I tried to compile the basic "hello world" programm but it doesn't work, despite the ...
0
votes
1
answer
169
views
How to link to libraries correctly in C for Windows [duplicate]
I'm currently trying my hand at C programming for Windows. I have Windows 11, I code on VS Code, and I have installed MinGW and correctly added it to the PATH. The problem is that I can't link my ...
3
votes
0
answers
361
views
How to write _start function to call the main function in C
By using inline assembly asm volatile, how can I implement _start function in C which can call the main function
int main(int argc, char *argv[], char *envp[])
I tried alot, but it didn't work at all,...
-1
votes
2
answers
113
views
Experiencing Segmentation Fault issue in C code on Windows machine only
I'm trying to pass the slice of the output of one function slice to another function, however I receive Segmentation fault error at line 93 in append_2d_slice slice function. I commented line which ...
2
votes
1
answer
114
views
C compiling and running
I'm new in C and I'm trying to run a simple helloworld, but the terminal is not displaying the output.
Here is the code:
int main(int argc, char *argv[])
{
printf("Hello");
return 0;
...
0
votes
1
answer
697
views
How do I write assembly for Windows x86 using GAS?
Subject: Understanding Assembly Code Generation for a Simple C Program on Windows
I've been diving into GAS assembly, primarily for 32-bit, in a guided course. To challenge myself, I wanted to work ...
0
votes
2
answers
646
views
libpcap doesn't do anything (Windows)
For 2 days now I am trying to get a simple packet live capture to work with libpcap and npcap on Windows 11. I am using MSYS2-compiled MinGW GCC compiler. I have installed libpcap through pacman and ...
0
votes
0
answers
127
views
using Nasm and gcc on windows (MinGW) for osdev
I am currently creating a simple kernel and I just jumped to using C with the GCC(MinGW) compiler on windows. but the way I am using C with assembly is kind of problematic here is what I am doing :
:: ...
1
vote
0
answers
73
views
This C code returns different values when run on GCC versus MS Visual Studio
This simple C code compiles without errors in both MS Visual Studio/Windows 11 and GCC/Linux.
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <time.h>
int main() {
...
0
votes
2
answers
199
views
Error during configuration: C compiler cannot create executables (Concorde TSP)
I'm currently experiencing an issue while trying to install and configure a software package (Concorde TSP solver) on my Windows machine using Cygwin. I've followed the installation instructions ...
0
votes
0
answers
840
views
Can't use arc4random(), even though I have #include <stdlib.h>
I'm trying to use arc4random_uniform() instead of rand % n in this program of mine, but I'm getting some problems related to my header files.
My code (summarized)
#include <stdlib.h>
#include &...
0
votes
1
answer
410
views
Armstrong C code gives a specific output error at 153 in Vs Code on Windows machine
I created C code to check armstrong number or not.
#include <stdio.h>
#include <math.h>
int main()
{
// Write a program to check if a given number of n digits is Armstrong number or ...
0
votes
0
answers
142
views
How crosscompile c program for win32 with mingw32 on linux
I need to compile my program for Windows 32 bit. But I'm using files from the /sys/ directory and mingw32 says it can't find them.
x86_64-w64-mingw32-gcc -std=c99 -g -ggdb -c ./client.c -o ./...
0
votes
0
answers
86
views
facing linking issue for using mariadb connector/c
I am trying to interact with mariadb database using mariadb connector/c. I have installed mariadb connector using msi file from official site. But bin file of connector is empty. I am new to c coding, ...
1
vote
0
answers
23
views
Undefined reference to `GetProcessMemoryInfo' [duplicate]
Hello I wanted to get the memory usage of a program (so i can for example detect memory leaks), but no matter what I do compiler throws:
undefined reference to `GetProcessMemoryInfo' collect2.exe: ...
0
votes
0
answers
39
views
How does one add <graphics.h> into GCC on a Windows computer for C? [duplicate]
So, I want to add graphics in a program, but <graphics.h> doesn't seem to be supported on the GCC compiler.
I don't have a Linux, so please include Windows Powershell solutions if using command ...
0
votes
1
answer
730
views
How do I include a needed C library using GCC in Visual Studio Code on Windows?
I am trying to compile a simple code in C with reference to this example. This is the code which uses curl library in C.
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
...
3
votes
2
answers
12k
views
'gcc' is not recognized - How to make gcc/mingw work in Windows?
The Mingw binary installation instructions (such as these) tells me to change the PATH environment variable in Windows, in order to use the gcc/g++ etc commands anywhere. This might also be necessary ...
1
vote
1
answer
42
views
Why is Cod::Blocks giving me Null instead of a input char?
Source Code:
#3 main.c
# include "func.h"
int main(void) {
func();
return 0;
}
#3 func.h
#include <stdio.h>
void inputName();
void printName();
void func();
#3 func.c
#...
0
votes
1
answer
58
views
Why when read and write performed back to back in file opened in rb+ mode behaves not as expected in c language
I opened a file in rb+ mode successfuly
Wrote two strings using two fputs.
File ptr moved to 3 byte from file beginning using fseek.
Read four characters successfuly using fgets.
Now when I tried to ...
2
votes
0
answers
102
views
SetLayeredWindowAttributes() causes mouse clicks to go through after minimizing window | WinAPI
Here is a video showing my problem.
As you can see after minimizing I am not able to press anything on the window besides that one pixel sweet spot.
How can I fix this? I am compiling through MinGW ...
3
votes
1
answer
423
views
What are the correct locale names on Windows?
I was trying to get the thousand separator used in Portuguese-speaking countries, on Windows, compiling my C code with GCC. For this, I was using locale.h's function
setlocale(int category, const char*...
1
vote
0
answers
714
views
Getting "NativeCommandFailed" error when executing program compiled with Mingw64 cc
Executing a Windows executable that was compiled with the cc compiler command (compiler installed with Mingw64 MSYS2 on Windows) results in an unexpected error.
I was compiling a slightly modified ...
0
votes
1
answer
151
views
readdir converts "…" in filename as "à" in C
I am trying to list all files in current directory and sub-directories so I can know the size of a directory by calculating the size of all the files in it. But d_name returns a different file name, ...
0
votes
1
answer
420
views
VS Code messing with quotation marks and spaces in paths
I configured VS Code for running MPI codes from the "Run task" button, but somehow it puts a " right next to the gcc call, throwing me errors for the paths that use them right.
"C:\...
0
votes
1
answer
890
views
Why gcc under Windows O.S. produces a .o instead of a .lib file when compiling static libraries?
I am using gcc 8.1.0 on Windows. To install it I set up Code::Blocks on my computer and updated the environment variable list by adding the path to the gcc.exe program within the installation folder ...
0
votes
1
answer
218
views
How to add gcc libraries and cross compile for windows?
When I use minGW for cross compiling for windows I get these errors. How can I add gcc library and cross compile for windows?
I am using x86_64-w64-mingw32-gcc
But it compiles with gcc without any ...
0
votes
0
answers
311
views
Lua 5.4 undefined reference with GCC
I'm trying to use gcc to dynamically link to the lua library but I keep getting undefined references to every single lua function, including luaL_newstate.
Here's the code I'm trying to compile
#...
3
votes
1
answer
2k
views
GCC can't find headers on Windows
I'm new in winAPI and I was learning how code programs with some special functions and such, so I downloaded the Windows's SDK.
Problem is, GCC decided to put the blind glasses and say:
Documents_path....
0
votes
2
answers
802
views
Comparing two binary search tree
What I'm trying to do is compare two binary search trees. This is in order to count the number of repetition that occurs on them.
First, I added this function that finds a specific element in a binary ...
0
votes
1
answer
152
views
How to compile PicoTCP minimal example on Windows
I was trying use picoTCP on Windows. I was following the how to compile on Windows from here. This compiled the library successfully with only notes of usleep being deprecated. The next step was to ...
1
vote
2
answers
807
views
Same expression as the destination warning when using snprintf
(I've seen questions 19202368, 40095973 and 1775403)
I have this:
char data[32];
memset(data, '\0', sizeof(data));
snprintf(data, sizeof(data), "%s - %d", aCharArray != NULL ? aCharArray : &...
2
votes
1
answer
1k
views
Error: "undefined reference to `__imp_GetOpenFileNameA'" Although I use gcc -lcomdlg32
I creat a file named "demo.c".
Here is the code:
#include <Windows.h>
#include <commdlg.h>
#include <stdio.h>
int FileDialog(char *path)
{
OPENFILENAME ofn;
...
1
vote
2
answers
3k
views
How do I compile with zlib on windows using gcc?
My aim is to compile zlib alongside my application files, I use gcc from tdm-gcc and have cloned the repository https://github.com/madler/zlib
in /example there is a zpipe.c file which utilizes the ...
1
vote
0
answers
10k
views
Getting an error "the input file is same as the output file
I am very new to C programming and I just installed mingw and started using vs code. I have installed all teh extension required in the VS code and have selected the default builder as gcc in the vs ...