Jump to content

[SOLVED] Compiling C code


fert

Recommended Posts

I'm using Ubuntu linux and i'm trying to compile a C code file using gcc, but when i try to do it i get these errors
[quote]
os.c: In function ‘main’:
os.c:3: warning: incompatible implicit declaration of built-in function ‘printf’
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
[/quote]
as far as i can tell i've done everything right
Link to comment
Share on other sites

Well, it doesn't really get much simpler does it? And funnilly enough, there is nothing wrong with your code.

Compiles fine here on Gentoo with GCC 4.1.1, and on Debian using GCC 3.3.5.

ld refers to Linux's standard linker which is part of binutils. Im not sure, but installing/ reinstalling binutils may help.

PS; Im not that sure that Ubuntu is really much of a choice when it comes to building apps.
Link to comment
Share on other sites

fert, can you try a few other common functions?  Like puts() or fprintf()?

Also, can you give the full output, from the command executed through to the error messages?  The error messages in your first post don't match the command line in the later post.  This makes me less confident that I am getting all the necessary information.  Even seemingly unimportant things can make the difference.
Link to comment
Share on other sites

Im pretty sure this is an Ubuntu issue. By default I don't think its setup to compile anything. though I would have thought it would be dragged in as a dep of gcc, you might try (re)installing the C libraries.

[code]
apt-get install glibc
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.