-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Milestone
Description
by anwar.root:
Based on go1.2 devel version, when golang call c/c++, displays the following error: $ Go version go version devel f4d1cb8d9a91 Thu Sep 19 22:34:33 2013 1000 linux/amd64 $ pwd /home/google/0/src/astyle $ ll total 452 -rwxr--r-- 1 ftp ftp 5451 Sep 23 17:14 ASLocalizer.h -rwxrw-rw- 1 ftp ftp 342 Sep 23 18:08 astyle.go -rwxr--r-- 1 ftp ftp 37668 Sep 23 17:14 astyle.h -rwxrw-rw- 1 ftp ftp 14501 Sep 23 18:18 astyle_main.h -rwxrw-rw- 1 ftp ftp 3523 Sep 24 09:11 cpplib.cpp -rwxrw-rw- 1 ftp ftp 158 Sep 23 18:11 cpplib.h -rwxrw-rw- 1 ftp ftp 384652 Sep 18 16:47 libastyle.a $ cd ../use_astyle $ pwd /home/google/0/src/use_astyle $ ll total 4 -rwxrw-rw- 1 ftp ftp 118 Sep 23 17:17 main.go $ Go build main.go # Astyle /tmp/go-build089296038/astyle/_obj/cpplib.cpp.o: In function `codeFormat ': /home/google/0/src/astyle/cpplib.cpp: 99: undefined reference to `AStyleMain ' collect2: error: ld returned 1 exit status But AStyleMain is declared, it is through cpplib.cpp contains astyle_main.h, then through astyle_main.h will contain astyle.h And astyle.h stated the following: extern "C" EXPORT char * STDCALL AStyleMain (const char *, const char *, fpError, fpAlloc); When I'm alone through the gcc compiler, compiling is ok $ ll total 704 -rwxrw-rw- 1 ftp ftp 5451 Sep 12 15:20 ASLocalizer.h -rwxrw-rw- 1 ftp ftp 37668 Sep 12 15:20 astyle.h -rwxrw-rw- 1 ftp ftp 14239 Sep 12 15:20 astyle_main.h -rwxrw-rw- 1 ftp ftp 384652 Sep 18 16:47 libastyle.a -rwxr-xr-x 1 root root 259758 Sep 24 09:21 test -rwxrw-rw- 1 ftp ftp 5313 Sep 24 09:21 test.cpp $ g++ -g -o test test.cpp -fpermissive libastyle.a $ ./test Formatted /home/ftp/format_cpp/quanSort.cpp
Attachments:
- go_astyle.rar (102973 bytes)
- Has_been_compiled_by_gcc.rar (102746 bytes)