Ammar
g++ src/main.cpp -c -o main.o this works
Ok, this compile to relocateable object, after this you need to link them.
V01D
Hm
Ammar
Ammar
There is main function or not?
V01D
What if you only link sfml-graphics (since it is all you need)
Ammar
..
objdump -d main.o sir
Ammar
What is the output then?
V01D
..
No he/she is asking whether gcc compiled with a main function
V01D
objdump -M intel -d main.o
Asdew
AT&T style > Intel style
Ammar
We don't really need to use -M intel, since we only assure the main symbol exists.
Ammar
AT&T style > Intel style
I love intel syntax, it is more readable to me.
V01D
I love intel syntax, it is more readable to me.
The only wtf thing about intel is the source and dest operands on mov
Ammar
AT&T: leal -1(%rdi), %eax Intel: lea eax, [rdi-1]
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
Ammar
This means that you did not compile the main function.
Ammar
g++ src/main.cpp -c -o main.o this works
Please show me the output of cat src/main.cpp
Asdew
I'd say it's Breakjaro at work.
V01D
That terminal is beautiful though
Asdew
A good terminal font is gohufont.
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
#include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.clear(); window.display(); } return 0; }
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
V01D
SDL needs that too
Ammar
That's strange.
Ammar
V01D
It is optional though.
Still worth a try. Maybe SFML needs that. SDL does too. (I could use it (sdl) without, but who knows. Might break on some systems)
M.Khorram
let's make a great app together
Hi, What type of app are you thinking about?
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
Is it gcc problem or sfml or do I need to install any dependencies? since it works on manjaro xfce I have already remove gcc and reinstalled
Hermann
/get cbook
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
Ammar
If it is long, please use pastebin or gist.
Ammar
Or this gcc -E src/main.cpp -o tmp.cpp
Ammar
Then send the tmp.cpp here.
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
Ammar
It seems your main.cpp is empty.
Ammar
I don't really understand the problem here.
Ammar
Your compiler does not say so.
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
V01D
Check again
V01D
Idk what to do either. Just change the distro if it works on others
V01D
Or do a full system upgrade, idk
V01D
Maybe someone did alias g++='echo "" > src/main.cpp && gcc -c' 🤪
V01D
There was a flag to make gcc act like a c++ compiler but I forgot what it was 😅
Vlad
And it will compile fine
Ammar
Could your compiler do this? See the main function does not get emitted here.
Ammar
echo 'int main() { return 0; }' > x.c g++ -E x.c -o /dev/stdout
Ammar
I just want to make sure that this is not a compiler bug.
V01D
afaik you can just gcc main.cpp
Yeah of course. Just some things are better with a c++ compiler
Andrew
its the -E flag that prints all things
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
🙇‍♂️ sorry
Ammar
its the -E flag that prints all things
Yes, including the #include'd files and macros expansion.
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
it was my fault
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
it was empty
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
i had opened another file in text editor
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
bruh
sorry
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
i just wasted your time 🙇‍♂️
𝖜𝖎𝖑𝖑𝖘𝖎𝖗
Mohannad
مساؤؤؤ
Vlad
مساؤؤؤ
Eng only brotha
Nils
How do I return the value of the rax register in C?
Mar!o
What do you mean?
Mar!o
If you return a value it will be returned in RAX if it's 64-bits else if 32 == EAX, 16 == AX etc...
Ammar
How do I return the value of the rax register in C?
Could you provide more details of your case?
V01D
How do I return the value of the rax register in C?
Bad idea. C handles the memory itself so rax in assembly != rax in C
Mar!o
Yeah and it always depends on the calling convention...
V01D
Just write assembly files along with C and push rax to the stack. Then return and done