Skip to content
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

Asio.hpp is Riddled with errors (also with config.hpp) #1553

Open
NahilTheDolfin opened this issue Oct 30, 2024 · 14 comments
Open

Asio.hpp is Riddled with errors (also with config.hpp) #1553

NahilTheDolfin opened this issue Oct 30, 2024 · 14 comments

Comments

@NahilTheDolfin
Copy link

So I'm working on an anonymous project. And also.hpp has at least 182 errors config has 8 only. And I wonder how to fix this please.Capture_decran_2024-10-30_232536.png

@klemens-morgenstern
Copy link
Contributor

This one should be used in a textbook about how to not write issues on github.

@joaotavora
Copy link

@NahilTheDolfin you have to add (a lot) more information about what you're trying to do with ASIO. What version you're using, how you are compiling, and more. This is sometimes known as a MRE (https://en.wikipedia.org/wiki/Minimal_reproducible_example) If you don't do that the chances that someone is going to go out of their way to guess what your problem is are extremely slim.

@NahilTheDolfin
Copy link
Author

@joaotavora I guess I should set the whole asio thing up before restarting I guess

@NahilTheDolfin
Copy link
Author

@NahilTheDolfin you have to add (a lot) more information about what you're trying to do with ASIO. What version you're using, how you are compiling, and more. This is sometimes known as a MRE (https://en.wikipedia.org/wiki/Minimal_reproducible_example) If you don't do that the chances that someone is going to go out of their way to guess what your problem is are extremely slim.

deos that mean i have set up ASIO? and i just need a yes or no response, but ill just set up asio to fix the problem and so i can continue on.

@NahilTheDolfin
Copy link
Author

This one should be used in a textbook about how to not write issues on github.

Goal: I’m using Asio to set up a node server and node client for a cryptocurrency project I’m building. The purpose is to manage decentralized network communication where nodes can validate transactions and share block data across the network.

Details

What I’m trying to do:
Set up asynchronous communication between nodes.

Handle multiple incoming and outgoing connections simultaneously for real-time updates.

Support both a node server (for handling requests) and a node client (for connecting users to the network).

Asio Version: 1.30.2

Compiler/IDE: GCC

Compiler: GCC
IDE: Visual Studio Code

OS: Windows 11

@klemens-morgenstern
Copy link
Contributor

These are not enough details.

@NahilTheDolfin
Copy link
Author

These are not enough details.

Ok no problem, just tell me what details i need to say. Thanks in advance

@NahilTheDolfin
Copy link
Author

so here is the code `#include
#include
#include <C:/Users/Admin/Desktop/NahilCoinSystem/NahilCoin Network/boost/asio.hpp>

using boost::asio::ip::tcp;

class NodeClient {
public:
NodeClient(const std::string& host, const std::string& port)
: resolver_(io_service_), socket_(io_service_) {
connect(host, port);
}

void requestData() {
    std::string request = "GET_LATEST_BLOCK"; // Replace with actual request
    boost::asio::write(socket_, boost::asio::buffer(request));

    char reply[1024];
    size_t reply_length = boost::asio::read(socket_, boost::asio::buffer(reply));
    std::cout << "Response: " << std::string(reply, reply_length) << std::endl;
}

private:
void connect(const std::string& host, const std::string& port) {
tcp::resolver::query query(host, port);
tcp::resolver::iterator endpoint_iterator = resolver_.resolve(query);
boost::asio::connect(socket_, endpoint_iterator);
}

boost::asio::io_service io_service_;
tcp::resolver resolver_;
tcp::socket socket_;

};

int main(int argc, char* argv[]) {
try {
NodeClient client("127.0.0.1", "12345");
client.requestData();
} catch (std::exception& e) {
std::cerr << "Exception: " << e.what() << std::endl;
}
return 0;
}`

OS : Windows 11 Professional
Asio Version: 1.30.2
Compiler IDE: GCC
Compiler: GCC
IDE: Visual Studio Code
DETAILS:

What I’m trying to do:
Set up asynchronous communication between nodes.

Handle multiple incoming and outgoing connections simultaneously for real-time updates.

Support both a node server (for handling requests) and a node client.

personally, its a little short, but i personally think asio should be set up so it can be fixed theres not any problems, just wanna know if i should set up asio, but if any more errors happens, that means i didnt give the other code, but hey. if you meet an error just tell me, and ill have pleasure to send other codes

@NahilTheDolfin
Copy link
Author

(and also when it stops at private dont worry i think it just misunderstood.

@NahilTheDolfin
Copy link
Author

These are not enough details.

and also

Langauge : C++

@klemens-morgenstern
Copy link
Contributor

Ok let me make one last attempt here, even though this seemed like a lost cause from the first message:

  1. Don't expect others to do your work for you - or just run your code on their machine
  2. Form sentences that approximate english.
  3. Format your code right (code blocks)
  4. Add information about how your building (C++ standard, compiler version)
  5. Include error messages (not as screenshots, but text)

And maybe then you will get some help.

@NahilTheDolfin
Copy link
Author

NahilTheDolfin commented Dec 20, 2024

Oh, i was just sending the original code i was working on and i did that for... i guess nothing, i use the GDB/LLDB C++ on VSC, to run some other codes, i use C++ git.exe build.

Hello again, so the error codes theyre like 181 and they're all the same "cannot open source file "asio/windows/object_handle.hpp"", thats the error and theyre basically all the same
and its the same in other files : "cannot open source file "asio/associated_cancellation_slot.hpp" from "any_completion_handler.hpp)
so... that's all i can describe, if i've missed anything, you can tell me and ill tell any missing details, so that means i should set up asio to fix the errors, right? (sorry if i am bothering you with that.)

thanks in advance for any help ! :D

@FarrilChrolsons
Copy link

Oh, i was just sending the original code i was working on and i did that for... i guess nothing, i use the GDB/LLDB C++ on VSC, to run some other codes, i use C++ git.exe build.

Hello again, so the error codes theyre like 181 and they're all the same "cannot open source file "asio/windows/object_handle.hpp"", thats the error and theyre basically all the same and its the same in other files : "cannot open source file "asio/associated_cancellation_slot.hpp" from "any_completion_handler.hpp) so... that's all i can describe, if i've missed anything, you can tell me and ill tell any missing details, so that means i should set up asio to fix the errors, right? (sorry if i am bothering you with that.)

thanks in advance for any help ! :D

So, i looked at it, then thought of it and my conclusion is : Yes, it is highly likely that setting up ASIO correctly will resolve the issue. The error message "cannot open source file 'asio/detail/config.hpp'" indicates that the ASIO library is not properly included or accessible in the project. Setting up ASIO involves downloading the library, including its headers in the project, and possibly linking against the required libraries.

@NahilTheDolfin
Copy link
Author

Oh, i was just sending the original code i was working on and i did that for... i guess nothing, i use the GDB/LLDB C++ on VSC, to run some other codes, i use C++ git.exe build.

Hello again, so the error codes theyre like 181 and they're all the same "cannot open source file "asio/windows/object_handle.hpp"", thats the error and theyre basically all the same and its the same in other files : "cannot open source file "asio/associated_cancellation_slot.hpp" from "any_completion_handler.hpp) so... that's all i can describe, if i've missed anything, you can tell me and ill tell any missing details, so that means i should set up asio to fix the errors, right? (sorry if i am bothering you with that.)

thanks in advance for any help ! :D

So, i looked at it, then thought of it and my conclusion is : Yes, it is highly likely that setting up ASIO correctly will resolve the issue. The error message "cannot open source file 'asio/detail/config.hpp'" indicates that the ASIO library is not properly included or accessible in the project. Setting up ASIO involves downloading the library, including its headers in the project, and possibly linking against the required libraries.

Thank you so much!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants