Giter Club home page Giter Club logo

Comments (12)

orignal avatar orignal commented on June 4, 2024

You should link libi2pd.a and lini2pd_client.a explicitly.

from i2pd.

layters avatar layters commented on June 4, 2024

I excluded libi2pdlang.a but that didn't work.
I've also explicitly linked the libraries as shown in this CMakeLists.txt (part of a larger project that I am currently working on). Still, I get the same results...

I had a similar issue with another external library but I fixed it by adding external "C" {} around the includes (of course, this was a C library and not a C++ one)

from i2pd.

orignal avatar orignal commented on June 4, 2024

I don't know what you are trying to do. Don't use cmake, but regular Makefile.
LIBS = i2pd/libi2pd.a
i2pd/libi2pd_client.a
-l boost_system
-l boost_filesystem
-l boost_program_options
-l boost_date_time
-l ssl
-l crypto
-l pthread
-l z

Everything gets linked properly. If your call your code not from C++ you have to write an external C wrapper, that's not a part of i2pd project.

from i2pd.

layters avatar layters commented on June 4, 2024

A regular Makefile literally made no difference at all. Same result. And my code is primarily C++, not C.

This is my Makefile by the way. All the required i2pd libraries are in the same directory as the source file (main() function was moved to main.cpp)

# Compiler
CXX := g++

# Compiler flags
CXXFLAGS := -std=c++17 -Wall

# Source files
SRCS := i2p.cpp main.cpp

# Output binary
TARGET := main

# Include directories
INC_DIRS := -I../../../external/i2pd/i18n -I../../../external/i2pd/libi2pd -I../../../external/i2pd/libi2pd_client

# Library directories
LIB_DIRS := -Li2pd

# Libraries
LIBS := libi2pd.a libi2pdclient.a -lboost_system -lboost_filesystem -lboost_program_options -lboost_date_time -lssl -lcrypto -lpthread -lz

# Build rule
all: $(TARGET)

$(TARGET): $(SRCS)
	$(CXX) $(CXXFLAGS) $(INC_DIRS) $(LIB_DIRS) -o $@ $^ $(LIBS)

# Clean rule
clean:
	rm -f $(TARGET)

Trust me, I've cloned i2pd and downloaded the latest source code from the releases page multiple times. I tried building with CMake, g++ via Terminal, and now Makefile - all which have failed.

Maybe I am including the wrong i2pd header files or it could be that my OS sucks, I dunno...

I'll try to upgrade my OS or build on a different computer I guess...

from i2pd.

orignal avatar orignal commented on June 4, 2024

You must specify the full path to libi2pd.a and libi2pd_client.a

from i2pd.

orignal avatar orignal commented on June 4, 2024

I tried to build your code. Everything links fine. Ubuntu 22.04

from i2pd.

layters avatar layters commented on June 4, 2024

Strange how it isn't linking properly for me?
I upgraded from Ubuntu 20.04 to 22.04 'cause I thought it'll solve this issue, but I guess not.

Edit: This issue has been resolved by a user on reddit

source: https://www.reddit.com/r/moneromarket/comments/1baavub/comment/kuadhlq/

from i2pd.

orignal avatar orignal commented on June 4, 2024

Edit: This issue has been resolved by a user on reddit

Didn't I suggest the same?

from i2pd.

layters avatar layters commented on June 4, 2024

from i2pd.

layters avatar layters commented on June 4, 2024

If you don't mind, could you give me some examples on how to use the SAM API for just reading and writing messages via UDP/Datagram? 'cause I dunno what I'm doing and I don't trust ChatGPT 😄

from i2pd.

orignal avatar orignal commented on June 4, 2024

https://github.com/PurpleBote/pboted uses SAM datagrams.

But if you link i2pd libs directly to your app why do you need SAM API? Create destinations and send datagrams directly from your code.

from i2pd.

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.