-
Notifications
You must be signed in to change notification settings - Fork 30
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
Some header file declarations in underscore.hpp are inconsistent with definitions in underscore.cpp #12
Comments
Can I work on this? |
Sure @srinath9721 |
@srinath9721 also make sure the order of functions is same in cpp and hpp files. Please ping if any help is needed. |
@srinath9721 are you still working on this. Kindly keep us updated. |
I'm working on a somewhat related branch. I'm introducing formal tests and when I try to use the functions in my test cases, I'm having a lot of issues linking the test executable. Things like:
And it all comes from clang warnings like:
Then I decided to make some tests with a basic templated function in underscore.hpp and underscore.cpp // underscore.hpp
template<typename T>
void say_foo(T foo); and then in the .cpp file // underscore.cpp
template<typename T>
void say_foo(T foo) {
std::cout << foo << std::endl;
} This would cause the same issues when trying to do: _::say_foo("Hello");
_::say_foo(1337); The problem exists because the compiler doesn't know of declarations for:
The easy solution to it all is to get rid of the .cpp code for templated functions and put the code in the .hpp, for the case of this library that'd mean moving all implementations to the .hpp and getting rid of the .cpp file, thus making the project a header only library. Otherwise it requires doing a bunch of forward declarations for each possible data type case use of each templated function If we move everything to the .hpp, then this issue is also solved, no inconsistencies would exist if there was a single file. Edit: |
Even I have faced a similar issue (not sure when). I am not sure, if it would be considered a "good practice" to keep both the implementation and headers in same file. Anyway your call. |
I'll try to research if there's a way to keep them separated and not have the linkage issues. |
Cool |
No description provided.
The text was updated successfully, but these errors were encountered: