[gambit-list] Getting an unresolved external symbol error when compiling a C

Fiel Cabral e4696wyoa63emq6w3250kiw60i45e1 at gmail.com
Sat May 8 13:00:36 EDT 2010


I tried compiling a C program compiled by Gambit C.
My compiler is Visual C++ 2010 Express Edition.
I'm getting this error: "unresolved external symbol ____G__20_h".
I included the steps I did to create the VC++ project below.
Please point out any mistakes.
Thanks.
-Fiel

Compiler error messages:
1>------ Rebuild All started: Project: h, Configuration: Debug Win32 ------
1>  Performing Custom Build Tools
1>  stdafx.cpp
1>  h.c
1>d:\user directories\user\documents\visual studio
2010\projects\h\h\h.c(103): warning C4102: '___L3__20_h' : unreferenced
label
1>d:\user directories\user\documents\visual studio
2010\projects\h\h\h.c(100): warning C4102: '___L2__20_h' : unreferenced
label
1>d:\user directories\user\documents\visual studio
2010\projects\h\h\h.c(98): warning C4102: '___L1__20_h' : unreferenced label
1>d:\user directories\user\documents\visual studio
2010\projects\h\h\h.c(92): warning C4102: '___L__20_h' : unreferenced label
1>d:\user directories\user\documents\visual studio
2010\projects\h\h\h.c(89): warning C4102: '___L0__20_h' : unreferenced label
1>d:\user directories\user\documents\visual studio
2010\projects\h\h\h.c(80): warning C4101: '___s64_temp' : unreferenced local
variable
1>d:\user directories\user\documents\visual studio
2010\projects\h\h\h.c(80): warning C4101: '___s32_temp' : unreferenced local
variable
1>d:\user directories\user\documents\visual studio
2010\projects\h\h\h.c(80): warning C4101: '___u64_temp' : unreferenced local
variable
1>d:\user directories\user\documents\visual studio
2010\projects\h\h\h.c(80): warning C4101: '___u32_temp' : unreferenced local
variable
1>  gambit.c
1>  Generating Code...
1>h.obj : error LNK2001: unresolved external symbol ____G__20_h
1>d:\user directories\user\Documents\Visual Studio
2010\Projects\h\Debug\h.exe : fatal error LNK1120: 1 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Here are the steps I took to create the Visual C++ project:

1. Project-wide settings (project type is unmanaged win32 console
application):

   - Added "C:\Program Files (x86)\Gambit-C\v4.6.0\lib" and "C:\Program
   Files (x86)\Gambit-C\v4.6.0\include" to additional include directories.
   "include" is needed for including "_gambc.c" in gambit.c below.
   - Added "C:\Program Files (x86)\Gambit-C\v4.6.0\lib" to additional
   library directories.
   - Added "___APPLICATION" to C preprocessor definitions. This causes
   main() to be defined.
   - Added "ws2_32.lib" and "libgambc.lib" to additional libraries.

2. Added file "h.scm" to project. Added custom build tool to compile "h.scm"
to "h.c". Custom build tool command line for h.scm:  "c:\Program Files
(x86)\Gambit-C\v4.6.0\bin\gsc.exe" -c "%(FullPath)".
3. Added file "h.c" to project. Set it to be compiled as C code. Turned off
usage of precompiled headers.
4. Added file "gambit.c" to project. Set it to be compiled as C code. Turned
off usage of precompiled headers.
5. Contents of h.scm:
(display "hello") (newline)
-----
6. Contents of "gambit.c":
#include "_gambc.c"
-----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20100508/63c8431e/attachment.htm>


More information about the Gambit-list mailing list