cs50 / libcs50

This is CS50's Library for C.
https://cs50.readthedocs.io/libraries/cs50/c/
GNU General Public License v3.0
1.74k stars 853 forks source link

'get_long' function not working #201

Closed lucas404x closed 4 years ago

lucas404x commented 4 years ago

Hi guys. So, I tried to run my solution on my computer. I installed the lib cs50 in my OS (Ubuntu 18.04) through the curl tool.

But when I went to compiler my program, I received this error in terminal:

`/tmp/cc2gMN9Z.o: In function 'main': credit.c:(.text+0x15): undefined reference to 'get_long' collect2: error: ld returned 1 exit status

: recipe for target 'credit' failed make: *** [credit] Error 1 ` Someone could help me, please?
Rubix982 commented 4 years ago

Hi @lucas404x ! Can you let us know what command you sued to compile the program? In my case, I would do something like

gcc test.c -lcs50 -o test

Where gcc is my compiler, test.c is my source file which has #include <cs50.h>, and test, the name of the file being generated for me to run.

lucas404x commented 4 years ago

Hi @Rubix982 !

Thank you very much! It working. =)

Rubix982 commented 4 years ago

That's great! Please let me know if you understand what -lcs50 does, and if you need any pointers to understand what it means. If not, that's great! Best of luck for the future.

seanderue commented 2 years ago

I appreciate your answer @Rubix982, it helped me too. Would you mind helping me understand what -lcs50 does?

EDIT: Nevermind I think I figured it out. Thank you though!

eltonMoraisD commented 1 year ago

@Rubix982 thaks a lot