-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go run command fails but go build runs ok (macOS) #33470
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
Comments
when i put defination from |
Specifically, what arguments (if any) did you pass to (Go is a compiled language; in general you should expect to run binaries using a |
@bcmills it used without argument ; but any clue if i had source file? any more arguent required?(i also read about this in |
Show us precisely what you did, for both |
@Arshiamidos, please cut and paste from the terminal window. Screenshots are neither efficient nor accessible, and it particular they make it very difficult for us to replicate the issue by cutting and pasting the same commands into our own terminals. |
Yes, please just cut and paste plain text. Don't show us an animated GIF. I tried to understand the animated GIF and as far as I can tell you showed us |
|
I've been able to reproduce it:
Since the program is using more than one file, I'm guessing that the single-file use of |
This all seems to be working as designed. @Arshiamidos, note in particular https://golang.org/cmd/go/#hdr-Package_lists_and_patterns:
|
it just use header file , what about source file .c ??@bcmills |
@Arshiamidos, Go is a compiled language. Sometimes you will need to use |
disagree @bcmills package main
/*
#cgo darwin LDFLAGS: -framework Cocoa
#include "tray.h"
*/
import (
"C"
)
import "fmt" |
What did you do?
What did you expect to see?
program work with
go run
What did you see instead?
Undefined symbols for architecture x86_64:
"_greet", referenced from:
__cgo_c4abf705382a_Cfunc_greet in _x002.o.
(maybe you meant: __cgo_c4abf705382a_Cfunc_greet).
ld: symbol(s) not found for architecture x86_64.
clang: error: linker command failed with exit code 1 (use -v to see invocation).
System details
The text was updated successfully, but these errors were encountered: