Giter Club home page Giter Club logo

Comments (4)

fpagliughi avatar fpagliughi commented on May 17, 2024

What platform are you trying this on? From the ".lib" I would assume a flavor of Windows?

I don't know Windows very well, and what limited experience I have with it is all with MSVC. So I'm not sure how much I can help. But...

It appears that you're working out of a build tree without installing it. In that case, the include files are not where you might expect. After install, the tree might look like:

usr
└── local
    ├── bin
    ├── include
    │   └── sockpp
    └── lib

So there's an include/sockpp (not just an include)
So on the command line, you tell it to look in include ( -I /usr/local/include )
And in the source, you specify to look in a sockpp subdirectory: ( #include <sockpp/tcp_connector.h> )

Then, in Linux, the g++ switch '-L' tells the linker where to look for files, but the '-l' (lower-case L) tells it the library files. I would assume MinGW does the same?

So, all together, the command line is:

$ g++ tcpecho.cpp -o tcpecho -I /my/install/path/include -L /my/install/path/lib -lsockpp

from sockpp.

ryanwe1ss avatar ryanwe1ss commented on May 17, 2024

Yeah, i'm trying to compile it in windows in order to run on it which I am using as a client where I connect to it from a linux server.

I'm pretty sure it should be very similar due to my experience using the MinGW compiler on both windows and linux being about the same in terms of command line parameters.

I'll give that command a try in a bit, just out at the moment but thank you very much otherwise for your feedback!

from sockpp.

ryanwe1ss avatar ryanwe1ss commented on May 17, 2024

So I tried running this compile command:
g++ main.cpp -o main -I "sockpp/include/" -L "sockpp/lib/sockpp-static.lib" -lsockpp

But my G++ compiler was unable to identify what "-lsockpp" is, outputting: cannot find -lsockpp (returned 1 exit status) on Windows. I was able to get it to work on Visual C++ but I couldn't get it to compile in release mode so it would not have to require the microsoft DLL's such as MSVCP140D.dll on any computer is runs on (self-contained). But so far this MinGW compiler I am using on Windows is installed the same way as it would be on linux and works as intended.

It is definitely a bit trickier on windows to perform these types of tasks but would you know how I could get MinGW to recognize what -lsockpp is?

from sockpp.

fpagliughi avatar fpagliughi commented on May 17, 2024

Sorry I never got back to this. I kept trying to figure out networking on Windows with MinGW, but I couldn't figure out the way different versions of the compiler define different macros. Like some versions seem to define _WIN32 and others don't?

So I gave up. Windows isn't a huge priority for me, and just getting MSVC working was enough of a chore. If you figured it out, let me know. I'm happy to put up instructions in the README or take whatever PR to make it work.

But, for completeness, with gcc, -L typically tells it where to look, so give that a directory. And -l tells it what library to link, with just the base file name, no extension. So in your case, together, it should just be:

g++ main.cpp -o main -I "sockpp/include" -L "sockpp/lib" -lsockpp-static

from sockpp.

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.