Giter Club home page Giter Club logo

Comments (12)

kamakazikamikaze avatar kamakazikamikaze commented on June 13, 2024

(Off-topic): Rather than create a new "issue" so I don't spam up so many topics in so little time, Visual Studio 2013 came up with an issue of not having <endian.h> as referenced in "endianness.h". I noticed that there was a "fixme later" in the comments. Have you seen this alternative public header that you could use? Maybe it could shortcut what you need to implement?

https://gist.github.com/panzi/6856583#file-portable_endian-h

from libtins.

mfontanini avatar mfontanini commented on June 13, 2024

Could you explain what isue did Visual Studio 2013 came up with? The only thing missing should be detecting whether Windows is little or big endian (and according to the header you linked, it would only be big endian on xbox, which is not a current target for the library).

from libtins.

kamakazikamikaze avatar kamakazikamikaze commented on June 13, 2024

I wonder if I should split this to a separate issue ticket since it's different from the first.

Anyways, VS 2013 came up with an error in endianness.h, line 49. It says

"cannot open include file 'endian.h': no such file or directory."

It seems to skip over the #elif defined (WIN32) on line 44 and jumps to the #else statement. Changing "WIN32" to "_WIN32" on line 44 appears to detect the system properly, however it links to another issue in pcap.h (line 40) where it also requires changing "WIN32" to "_WIN32" or else it fails the logic statement.

At this point I don't know if changing that would do more harm than good, given that this creates more errors (security check C4996) that requires workarounds and disabling features.

from libtins.

kamakazikamikaze avatar kamakazikamikaze commented on June 13, 2024

Sample of the initial issue

image

Changing WIN32 to _WIN32 shows that the logic passes (notice that the block isn't as faded, showing that this statement is what will be used)

image

from libtins.

mfontanini avatar mfontanini commented on June 13, 2024

I see, so the issue seems to be the macro that's being used. I never had problems with WIN32, but apparently _WIN32 is the right thing to use.

from libtins.

kamakazikamikaze avatar kamakazikamikaze commented on June 13, 2024

Changing it within those two files, as I have tested, seems to clear out issues as far I can tell. I can't seem to get QT Creator nor VS2013 to properly link to tins.lib so that I can look into it further but I think you've got an idea of what to look into.

from libtins.

kamakazikamikaze avatar kamakazikamikaze commented on June 13, 2024

Mkay, I cleaned up my project a little and retried building the project with the changes of WIN32 to _WIN32 in the two header files I've mentioned. I then get this error (no idea if it's an issue with settings on my end or not):

1>------ Build started: Project: SERIAL2, Configuration: Debug Win32 ------
1>  main.cpp
1>c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility(2798): error C4996: 'std::_Equal1': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\xutility(2783) : see declaration of 'std::_Equal1'
1>          c:\program files (x86)\microsoft visual studio 12.0\vc\include\tins\ipv6_address.h(140) : see reference to function template instantiation 'bool std::equal<Tins::IPv6Address::const_iterator,Tins::IPv6Address::const_iterator>(_InIt1,_InIt1,_InIt2)' being compiled
1>          with
1>          [
1>              _InIt1=Tins::IPv6Address::const_iterator
1>  ,            _InIt2=Tins::IPv6Address::const_iterator
1>          ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

(This is all I have in my main.cpp)

#include <iostream>
#include <tins\tins.h>

using namespace std;
using namespace Tins;

void main(){
    cout << "Hello world" << endl;
    NetworkInterface iface;
}

from libtins.

mfontanini avatar mfontanini commented on June 13, 2024

It seems like you're using some flag that turns warnings into errors. That should be a warning, not an error. You can disable it using the compiler's suggestion, just define _SCL_SECURE_NO_WARNINGS.

from libtins.

kamakazikamikaze avatar kamakazikamikaze commented on June 13, 2024

Got it. Disabling that gives error LNK2038 for the _ITERATOR_DEBUG_LEVEL ("value '0' doesn't match value '2' in main.obj") which appears to be on my end. I'm not familiar with Visual Studio but I can see that from here on out all issues reside outside of the libtins project. Thanks for your help!

Will you be changing WIN32 to _WIN32? If so, I'll keep my eyes peeled for a new commit

from libtins.

mfontanini avatar mfontanini commented on June 13, 2024

Yeah, I'll change that soon, maybe tonight.

The _ITERATOR_DEBUG_LEVEL thing is caused by the library being compiled on Release mode and your code on Debug or viceversa. Just compile both of them on the same mode and you'll be fine.

from libtins.

kamakazikamikaze avatar kamakazikamikaze commented on June 13, 2024

Gotcha. I noticed that and changed settings accordingly. Does "RelWithDebInfo" work with user code compiled in both Debug and Release?

Nevermind, it does not! Alright, I'll go about fixing my linker errors. Thanks for your help!

from libtins.

mfontanini avatar mfontanini commented on June 13, 2024

I pushed a fix for this. Thanks for the report!

from libtins.

Related Issues (20)

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.