Skip to main content

All Questions

Tagged with
1 vote
1 answer
112 views

error: impossible constraint in 'asm' with -m32 for an "i" ("string") operand: string address as immediate

I am just wondering why this code: void test(void) { asm volatile( "ud2\n\t" ".long " "%c0" "\n\t" ".word %c1\n\t&...
user14825657's user avatar
0 votes
1 answer
54 views

Trying to compile an example X11 program using gcc, failing to find "bitmaps/icon_bitmap"

I'm trying to compile an example program from chapter three of Volume One of the Xlib Programing manual. I get an error saying that there is no such file or directory for #include "bitmaps/...
voidkitten's user avatar
1 vote
1 answer
98 views

"variable-sized object may not be initialized" error message when number of elements are calculated with float

With GCC 11.4 (-std=c99) on Linux WSL, there is an compile error as in example 2) in the code below. I have not gotten this kind of error with other compilers such as TASKING, MULTI, ti-arm-clang. Do ...
堀良寛's user avatar
2 votes
1 answer
63 views

Why does this function pointer typedef behave differently when used with const?

#include <stdio.h> typedef int (*func_t)(int); int foo(int x) { return x * 2; } int main() { const func_t ptr = foo; // Works //const func_t *ptr = &foo; // Fails: why? ...
Alphin Thomas's user avatar
1 vote
3 answers
94 views

Why does this macro with a comma operator fail to compile in a switch statement?

#include <stdio.h> #define PRINT(x) (printf("%d\n", x), x) int main() { int a = 1; switch (a) { case PRINT(1): puts("Case 1"); break; case PRINT(2)...
Alphin Thomas's user avatar
2 votes
1 answer
92 views

gcc throws compiler errors on every line of ARMv8 assembly function

I am trying to compile the following function: #include <stdio.h> extern long long int f(int a, int b); int main() { long long int x = f(3, 2); printf("Value of x = %lld\n", ...
Bhavesh Saravanakumar Chitrade's user avatar
1 vote
0 answers
48 views

My project build is failing to compile with gcc - WinMain issue? [duplicate]

Makefile is not working as expected. Compiling in windows with MSYS2 MinGW 64-bit - LDFLAGS is causing issue and I've tried two options..... LDFLAGS = -lSDL2 -lncursesw -mconsole and currently... ...
ogbreaks's user avatar
3 votes
1 answer
73 views

Can I use WASAPI in C code on MinGW64? If so, how?

I am using MinGW64 which has the necessary headers to use WASAPI. However, following the WASAPI programming guide I added following code: const CLSID CLSID_MMDeviceEnumerator = __uuidof(...
Manatee Pink's user avatar
1 vote
1 answer
62 views

Compilation error: unknown type name 'HardwareSerial'

I need to write a code to send data via UART. I wrote a test code on Arduino IDE in a .ino file and it worked perfectly. Now I trying to shift the code to a .c file. My code is as follows: #include &...
Mobi Zaman's user avatar
1 vote
0 answers
50 views

Can ARMCC generate a warning for implicit conversion?

I am trying to find the armcc equivalent of the gcc option that generate a warning if there is a sign mismatch when passing in integers into a function. In gcc, these compiler options will generate an ...
user's user avatar
  • 11
0 votes
1 answer
75 views

gcc complains for infinite recursion while freeing binary tree

I am trying to write a generic free function for a binary tree. typedef struct s_tree { void *content; struct s_tree *left; struct s_tree *right; } t_tree; void ft_treeclear(...
Bastian's user avatar
  • 63
0 votes
1 answer
73 views

Condition always false PORTG

I am trying to compile this code and I'm getting a WARNING and an ERROR. I'm using PIC-C Compiler. I'm using a PIC24FJ256GA410. I have an LED at pin G0 and I have a pull-up resistor at pin G13. Why ...
yeluissss's user avatar
27 votes
3 answers
5k views

Is `(expression, lvalue) = rvalue` a valid assignment in C or C++? Why do some compilers accept/reject it?

Some time ago I stumbled upon the idea of how a C construct, such as (expr0, expr1, expr2), evaluates (see "What does the comma operator , do?" for more context). I've started experimenting ...
sleeptightAnsiC's user avatar
2 votes
0 answers
92 views

why does my VSCode exit with code 127 when trying to compile a C file using gcc?

I'm trying to compile a C file using gcc. I'm in the right directory and all the files included in the C file i'm trying to compile is in the same directory. I can compile other files but I can't ...
mayunaise's user avatar
0 votes
2 answers
94 views

compiler complains that an unused variable is used when simply a cast to void is performed

We just found out that a certain compiler (Greenhills) sees the following construct as an error: // local variable mytype x; ... ((void) (x)); The compiler reports: error #549-D: variable "x&...
Sterpu Mihai's user avatar

15 30 50 per page
1
2 3 4 5
149