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

Error building shortest_path.go #67

Closed
internetbird opened this issue Oct 19, 2016 · 5 comments
Closed

Error building shortest_path.go #67

internetbird opened this issue Oct 19, 2016 · 5 comments

Comments

@internetbird
Copy link

Hi,

When I try to build shortest_path.go, I get the following error messages:

.\shortest_path.go:54: undefined: nodeDistanceHeap
.\shortest_path.go:72: undefined: nodeDistance
.\shortest_path.go:86: undefined: nodeDistance

I couldn't find any reference to nodeDistanceHeap or nodeDistance in the project. Am I missing something?

@gyuho
Copy link
Owner

gyuho commented Oct 19, 2016

What command did you run to build? goraph is a package to be imported.

Normally you would just import "github.com/gyuho/goraph" in your Go program.

@internetbird
Copy link
Author

internetbird commented Oct 19, 2016

I just copied the shortest_path.go file to my project and build it with my "main" package using 'go build' command.

the file has the following dependencies:

import (
    "container/heap"
    "fmt"
    "math"
)

which seem to be all ok...

@gyuho
Copy link
Owner

gyuho commented Oct 19, 2016

@internetbird In Go, you need all the files in package goraph workspace. Otherwise you need to copy manually all those structs nodeDistance, and so on.

import (
    "container/heap"
    "fmt"
    "math"
)

those are standard packages, so no need to worry about it.

Just find all these definitions

.\shortest_path.go:54: undefined: nodeDistanceHeap
.\shortest_path.go:72: undefined: nodeDistance
.\shortest_path.go:86: undefined: nodeDistance

in goraph and copy to your project.

Repeat this until it compiles.

@internetbird
Copy link
Author

@gyuho , thanks. I did a GitHub search : "nodeDistanceHeap in:file"
and I found some references in the Readme.md file of your learn repository

image

I will copy the definitions to my file and hopefully it will work.

I think it is a good idea to also add the definitions to this repository...

@gyuho
Copy link
Owner

gyuho commented Oct 19, 2016

All definitions are defined in this repository. Go allows to separate a single package code into different files. As you find so, you just need to copy those to your project and see if it compiles.

I am closing this, but if you have more questions feel free to ask here or file a new issue.

Thanks!

@gyuho gyuho closed this as completed Oct 19, 2016
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