Hello everyone
I am trying to learn about the compilation process. I am working on a pretty simple SDL game, but I know that making games isn't very practical, so I am using the project to learn about other programming aspects as well. One of the things I am trying to learn about it the full compilation process, in detail. I have found an interesting article on the subject at: http://www.lisha.ufsc.br/teaching/os/exercise/hello.html
However, I followed the same steps the author of the article did, and I am having a lot of trouble in the linking stage. When I do the same thing the author did, I end up with a lot of undefined reference errors. If I link without the -static flag, it looks like it works, but when I try to run the executable, I get the error bash: ./hello: No such file or directory
(which is not true, I can confirm that it exists and has the correct permissions with "file" and "ls -lA"). I thought that maybe the issue was my 64 bit processor and I was linking against some 32-bit libs, so I tried linking against libs from /usr/lib64/ instead on /usr/lib/ but the result was the same.
If I can't get this simple "hello world" code to build correctly, my game certainly won't. What am I missing?
I am using linux and gcc, if that isn't obvious.
gcc version 4.3.3
Recommended Answers
Jump to Postuncool_jatish,
YOU PLAGIARIZING <<flower>>
if you're going to beg for "ratings" by stealing someone else's work, at least have the common courtesy to paraphrase your source material rather than posting it verbatim.
or do you think we're so stupid we can't find where you cut and paste …
Jump to Post@prushik
You may well find it easier, initially to link through gcc (or g++) Both of these programs are really entry points onto the entire tool chain rather than actual compilers which is why you have to issue them the
-c
switch to make the only compile. Similarly to …
Jump to Postdont bring your parents and teachers into this. they're already terribly upset at how spectacularly they FAILED with you.
seriously, <<snip, snip, snip & snip>>
You're currently this --> || close to getting (another) "keep it pleasant" infraction, which will get you banned for the next 6 months.
Have a …
All 12 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.