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

Graph.h syntax error and illegal qualified name #1

Open
val-exe opened this issue Dec 3, 2020 · 1 comment
Open

Graph.h syntax error and illegal qualified name #1

val-exe opened this issue Dec 3, 2020 · 1 comment

Comments

@val-exe
Copy link

val-exe commented Dec 3, 2020

I just downloaded the library trying to implement it in a project of mine.

I am running into two issues, both in "Graph.h".

Firstly, on line 111, there is an illegal qualified name in member declaration, which can be fixed by deleting the "Graph::" from "Graph::findNodeById".

Secondly, and harder to fix (for me, as I am not an extremely experienced C++ programmer) there is a syntax error in the "Graph& operator << (T& rEdge)" definition, at line 86.

The code reads:
"

// forward as r-value reference
        makeEdge(std::move(rEdge))
        return *this;

"

Which visual studio is suggesting adding a semi-colon at the end of the line containing makeEdge. However, doing that (which I get the feeling is not the correct answer) generates two more issues, at line 74:

"
Error C2440 '': cannot convert from 'initializer list' to 'T'
Error C2672 'Graph::makeEdge': no matching overloaded function found
"

I am building with ISO C++14 Standard and Legacy MSVC C Standard.

Any help on the issue would be greatly appreciated.

@joechai93
Copy link

joechai93 commented Jan 20, 2022

I get the same error but was able to build using CMake. The diff I used to successfully compile is:

diff --git a/Graph.h b/Graph.h
index a507011..8a98c7a 100644
--- a/Graph.h
+++ b/Graph.h
@@ -83,7 +83,7 @@ public:
     template<class T>
     Graph& operator << (T&& rEdge) {
         // forward as r-value reference
-        makeEdge(std::move(rEdge))
+        makeEdge(std::move(rEdge));
         return *this;
     }
 
@@ -108,7 +108,7 @@ public:
     * Retrieves a node by the given id. 
     * @return a pointer to the node or NULL if not found. 
     */
-    Node* Graph::findNodeById(const std::string& id);
+    Node* findNodeById(const std::string& id);
 
     /** Retrieves all edges that have rSrc as source node and rDst as destination node. */
     tEdges findEdges(const Node& rSrc, const Node& rDst);

patinoboh added a commit to patinoboh/libgraph that referenced this issue Aug 11, 2024
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

2 participants