Comments (4)
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.
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.
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.
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)
- Can I clone a udp_socket HOT 3
- Error in cross-compiling for SH4 Linux HOT 3
- Win32 build issue with Unicode HOT 4
- Cannot use UDP sockets: unresolved external symbol HOT 3
- Moving toward stateless I/O without exceptions HOT 2
- Adding debug postfix
- Is there or will there be a way to join a multicast group? HOT 6
- Partial shutdown socket handle release.
- Fail to get data after second connect via Unix Domain Sockets
- Android compilation is broken with recent NDK (strerror_r) HOT 1
- Use std::span() HOT 13
- Non-blocking accept HOT 7
- CMake error with old CMake version HOT 4
- Build failed with -DSOCKPP_BUILD_TESTS=ON HOT 7
- uniform_int_distribution<char> does not compile with libc++ HOT 3
- Nagle's molasses tar pit algorithm, default HOT 4
- Strange build failure on i386 HOT 5
- Examples are out of touch with reality and documentation HOT 4
- Broken example 'tcpecho' HOT 6
- SO_REUSEADDR HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sockpp.