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

multiple definition of 'xxx'; ... first defined here #936

Open
huangtk-gaoq opened this issue Jul 4, 2023 · 1 comment
Open

multiple definition of 'xxx'; ... first defined here #936

huangtk-gaoq opened this issue Jul 4, 2023 · 1 comment

Comments

@huangtk-gaoq
Copy link

Bug Reports

  • VIC.5.0.1
  • linux
  • ubuntu
  • I downloaded VIC 5.0.1, open ubuntu terminal, enter path cd VIC-VIC.5.0.1\vic\drivers\classic\ and print make, it should generate a .exe file named "vic_classic.exe", but it didn't and shows lots of lines of similar mistakes such as /usr/bin/ld: /tmp/cctyYjct.o:/home/htk/VIC-VIC.5.0.1/vic/drivers/classic/../../vic_run/include/vic_log.h:61: multiple definition of LOG_DEST'; /tmp/cc6S4S9n.o:/home/htk/VIC-VIC.5.0.1/vic/drivers/classic/../../vic_run/include/vic_log.h:61: first defined here`.
  • I am very new to C code , so really don't have any clue how to fix it.
    截图 2023-07-04 16-30-28
    截图 2023-07-04 16-29-24
@pyested
Copy link

pyested commented Mar 5, 2024

Hi, I've faced the same problem and was able to solve it. It seems that some versions of ld exit with an error in case of multiple definitions. The way to solve it is to allow multiple definitions. I've done this adding the flag -Wl,--allow-multiple-definition in the Makefile to the CFLAGS variable (see image below). This way the compilation exits without errors. Hope this is helpful.

flag

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