Coder Social home page Coder Social logo

duplicated symbol error about hessian2-codec HOT 6 CLOSED

alibaba avatar alibaba commented on April 27, 2024
duplicated symbol error

from hessian2-codec.

Comments (6)

zyfjeff avatar zyfjeff commented on April 27, 2024

Let me do some research first

from hessian2-codec.

wbpcode avatar wbpcode commented on April 27, 2024

https://github.com/wbpcode/hessian2-codec/tree/52e51c4602d64db95b5b7484ca8229254fee6a2f

Checkout this repo and commit and run:

bazel build //example/mutiple_src:mutiple_src

It will be multiple definition error.

And checkout to 7ab8660, run above command again, it will be ok. (7ab8660 moved function definition to .cc)

from hessian2-codec.

wbpcode avatar wbpcode commented on April 27, 2024

If a function template specialization specifies all template parameters, then it is a normal function, not a template. The declaration and implementation should be separated in this case to avoid redefinition errors.

@zyfjeff

from hessian2-codec.

zyfjeff avatar zyfjeff commented on April 27, 2024

@wbpcode You're right. That seems to be the reason.
https://stackoverflow.com/questions/4445654/multiple-definition-of-template-specialization-when-using-different-objects

from hessian2-codec.

wbpcode avatar wbpcode commented on April 27, 2024

I I have completed a version in which the definitions of related functions have been moved to the cc file. Of course, directly declaring related functions as inline can also solve this problem. If you prefer the former, I can submit a PR directly. If you prefer the latter, May be I can take the time to prepare another PR tomorrow to solve this problem.

@zyfjeff

from hessian2-codec.

zyfjeff avatar zyfjeff commented on April 27, 2024

@wbpcode The former is better, and separating implementation and declaration is a best practice.

from hessian2-codec.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.