All Questions
15,762
questions
0
votes
1
answer
56
views
Passing `volatile` buffers to library functions which do not take `volatile`
I have a multi-processor system with a "shared" memory region used for communication. In some cases one of the processors needs to process some considerably large data in the shared memory ...
1
vote
0
answers
53
views
No compile time errors or warnings are being shown on my terminal window in vs code
I am using c language and I am working on windows using gcc compiler..I have also installed extensions like code runner and c\c++ Microsoft one too.
For example,
If I put an assignment operator in the ...
1
vote
0
answers
34
views
C - Packed struct - different behavior in different compilers
I've wrote a function that writes file-info into another file (in bin-format).
I've built it for WINDOWS executable, in two different environments:
eclipse, using mingw gcc:
GCC: (MinGW.org GCC-6.3.0-...
1
vote
0
answers
36
views
Correct Method to Place Multiple Arrays in a Custom Flash Section in C using GCC
I need to store a constant array in flash memory at a specific location using GCC in my embedded C project. For a uint32_t value, I managed to do it like this, and it works:
const uint32_t ...
-1
votes
0
answers
32
views
i386-elf-gcc: fatal error: cannot execute 'cc1plus': execvp: No such file or directory
I have this c code:
extern "C" void main() {
*(char*)0xb8000 = "Q";
return;
}
and when I try to compile it whit this command: i386-elf-gcc -ffreestanding -m32 -g -c "...
0
votes
0
answers
68
views
Error cross compiling on windows 64 bit to x86 32bit with i368-gcc - "Warning: .type pseudo-op used outside of .def/.endef ignored."
I'm trying to make a simple os that uses the x86 32 bit architecture,
my kernel is the following: kernel.c:
void dummy_test_entrypoint() {
}
void main() {
char* video_memory = (char*) 0xb8000;
...
0
votes
1
answer
58
views
How to compile and run a C script in MSYS2
beginner programmer here, I am trying a rudimentary approach, where I write some c code in a text editor (notepad++) and wish to compile it using gcc. The way to do this I found would be to install ...
1
vote
1
answer
65
views
dSYM not generated when building with make
On macOS 12.7.5 (Monterey) using gcc to compile *.c: gcc version 13.2.0, with gnu make 3.81, (I prefer command line tools over XCode), when I pass CFLAGS = -g in a makefile I get full debugging ...
-3
votes
0
answers
44
views
mingw32/bin/ld.exe: cannot find -lomp
I'm trying to test a program in C for a friend to compare performances of the "sieve of Eratosthenese". I'm testing it in Visual Studio Code and in the terminal, they tell me to put this in ...
3
votes
0
answers
143
views
GCC optimizes x + n > y as x + (n-1) >= y?
In general, the program
extern int x, y;
int main() {
return x + N > y;
}
is optimized into something akin to x + N-1 >= y for some given N. Example below. Am I reading the assembly right? ...
-2
votes
0
answers
73
views
Only the First Line of Output is Printed in C Program in VS Code on Windows Using MinGW
In C program only the first line of output is printed when I run the compiled executable. Despite the program compiling without errors, the subsequent lines do not appear.
Details:
Operating System: ...
0
votes
2
answers
111
views
GCC compiler handles "char * str" and "char str[]" with the & operator differently [duplicate]
The compiler treats the types char * var and char var[] differently when it comes to taking the address of a variable via the & operator. Here's a little snippet of code to demonstrate:
#include &...
1
vote
0
answers
77
views
/usr/bin/ld multiple definition of during compile
I just want to mention that I didnt write this code or modify it in any way prior to trying to compile it. I have just been copying the source from EL5 to 6 to 7 and compiling it. I think when it went ...
0
votes
0
answers
31
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 ...
2
votes
1
answer
113
views
can I overwrite the malloc called by library functions?
my code (main.c):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void* __real_malloc(size_t size);
void __real_free(void* ptr);
void* __wrap_malloc(size_t size)
{
...