-
Notifications
You must be signed in to change notification settings - Fork 358
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
chapter 1 chat undefined: newRoom #69
Comments
you can build the chat.exe like this go build -o chat.exe main.go client.go room.go。 |
thank you! |
I had this problem too ... You need to make sure your .go files are located inside a dirrectory, that is located inside the /src folder off your $GOPATH. When calling go build, the golang only searches the src folder of your $GOPATH for files to include ... so that will fix your issue! ex: |
Also .. you only need to call "go build" in the folder with all your files ... then you can call "go run chat" |
$ go run main.go
$ go build main.go
command-line-arguments
./main.go: undefined: newRoom
$ go run room.go
$ go build room.go
command-line-arguments
./room.go: undefined: client
$ go run client.go
$ go build client.go
command-line-arguments
./client.go: undefined: room
$ go build -o chat
$ ./chat
chat can't run.
why? 'chat' file is not extension.
because add extension 'exe'
$ go build -o chat.exe
./chat.exe
Good run.
please saying.
What's wrong?
The text was updated successfully, but these errors were encountered: