Hi I am trying to compile simple C programs in my computer and I get the similar msgs from under the terminal [see images] when compiling, stating some sort of assembly error. I dont know if this is a computer memory/stack issue (although I have restarted my computer) or anything else, but what I know for sure is that I have been compiling C programs these past days in the same manner.
Code:
#include <stdio.h>
main(){
printf("hello");
}
Output:
/tmp/cconajAc.s: Assembler messages: /tmp/cconajAc.s:9: Error: suffix or operands invalid for `push'
Please tell me how to fix this!
EDITED: I have just changed from workstation from another computer lab room and it works alright with no assembly errors whatsoever. My guess would be an error in the development tools installed in those computers in the other lab room. I guess for now this works for me although it would be interesting to know the source of the problem that I had in the other computer.
The error seems strange but try adding a return type to your main()
: int main()
.
Write in vi editor and save the file as "hello.c":
#include <stdio.h>
int main() { printf("hello"); return 0; }
Check if you have the 32-bit glibc headers installed.
Try this in ubuntu to install:# apt-get install gcc-multilib
Then try:# gcc -m32 -o hello hello.c
# gcc Wa,--32
else
# gcc -m32 --32
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With