Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collect2: error #97

Open
tjohnna opened this issue May 19, 2021 · 2 comments
Open

collect2: error #97

tjohnna opened this issue May 19, 2021 · 2 comments

Comments

@tjohnna
Copy link

tjohnna commented May 19, 2021

By running 'make f' I encountered the following error:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function _start': (.text+0x24): undefined reference to main'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:51: so] Error 1
make[1]: Leaving directory '/mnt/c/Curs21/lvl1/libft'
make: *** [Makefile:162: libft.so] Error 2

I am working on WLS
Ubuntu 20.04.2 LTS
Win10 20H2 64bit

@bh90210
Copy link

bh90210 commented May 27, 2021

hello @tjohnna I see u passed ur libft successfully so congrats 🎉

I had the same issue and for posterity the solution was to use the -nostartfiles flag as per this suggestion https://stackoverflow.com/questions/11116399/crt1-o-in-function-start-undefined-reference-to-main-in-linux

so:
	$(CC) -nostartfiles -fPIC $(CFLAGS) $(SRC)
	gcc -nostartfiles -shared -o libft.so $(OBJ)

@github-actions
Copy link

github-actions bot commented Sep 3, 2022

Hello! Thanks for contributing to the libft unit test.

Note that this repository is not maintained by the owner anymore, instead there is a bot that will automatically merge any reviewed pull requests.
If you feel like it, here are some links that can help you submiting a change in the code base::

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants