www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Phobos problem - compilation

reply AnIHiL <aanihill hotmail.com> writes:
Hello,

I copy one of the examples from GtkD project site:

import gtk.MainWindow;
import gtk.Label;
import gtk.GtkD;

void main(char[][] args)
{
	GtkD.init(args);
	MainWindow win = new MainWindow("Hello World");
	win.setDefaultSize(200, 100);
	win.add(new Label("Hello World"));
	win.showAll();

	GtkD.main();
}

I use CodeBlock to compile it but I have an error. This is log from compilation:

-------------- Build: Debug in asd ---------------

Compiling: hello.d
Linking console executable: bin\Debug\asd.exe
D:\D\dmd\bin\..\..\dm\bin\link.exe
obj\Debug\hello,bin\Debug\asd.exe,,D:\D\dmd\lib\phobos.lib+D:\D\dsss-0.73-dmd-win\lib\DD-atk.lib+D:\D\dsss-0.73-dmd-win\lib\DD-cairoLib.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gdk.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gdkpixbuf.lib+D:\D\dsss-0.73-dmd-win\lib\DD-glade.lib+D:\D\dsss-0.73-dmd-win\lib\DD-glib.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gobject.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gthread.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gtk.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gtkc.lib+D:\D\dsss-0.73-dmd-win\lib\DD-pango.lib+user32+kernel32/noi;
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegQueryValueExA 24
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegCloseKey 4
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegQueryInfoKeyA 48
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegCreateKeyExA 36
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegOpenKeyExA 20
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegOpenKeyA 12
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegDeleteKeyA 8
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegSetValueExA 24
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegDeleteValueA 8
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegFlushKey 4
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegEnumKeyExA 32
D:\D\dmd\lib\phobos.lib(registry) 
 Error 42: Symbol Undefined _RegEnumValueA 32
--- errorlevel 12
Process terminated with status 12 (0 minutes, 0 seconds)
12 errors, 0 warnings

This is my sc.ini file:
[Version]
version=7.51 Build 020

[Environment]
LIB=D:\d\dm\lib;D:\d\dmd\lib
DFLAGS="-I% P%\..\src\phobos" -Id:\d\dmd\import
-Id:\D\dsss-0.73-dmd-win\include\d
LINKCMD=% P%\..\..\dm\bin\link.exe
 
I already added in CodeBlock GtkD librarys and phobos library but this code
doesn't work. 

Can someone help me ?
Nov 22 2007
next sibling parent reply Nathan Reed <nathaniel.reed gmail.com> writes:
AnIHiL wrote:
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegQueryValueExA 24
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegCloseKey 4
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegQueryInfoKeyA 48
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegCreateKeyExA 36
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegOpenKeyExA 20
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegOpenKeyA 12
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegDeleteKeyA 8
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegSetValueExA 24
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegDeleteValueA 8
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegFlushKey 4
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegEnumKeyExA 32
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegEnumValueA 32

These functions are in the Windows API, not part of phobos. I guess you need to link with some import libraries for user32.dll and/or kernel32.dll. Thanks, Nathan Reed
Nov 22 2007
next sibling parent reply Robert Fraser <fraserofthenight gmail.com> writes:
Nathan Reed wrote:
 AnIHiL wrote:
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegQueryValueExA 24
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegCloseKey 4
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegQueryInfoKeyA 48
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegCreateKeyExA 36
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegOpenKeyExA 20
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegOpenKeyA 12
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegDeleteKeyA 8
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegSetValueExA 24
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegDeleteValueA 8
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegFlushKey 4
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegEnumKeyExA 32
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegEnumValueA 32

These functions are in the Windows API, not part of phobos. I guess you need to link with some import libraries for user32.dll and/or kernel32.dll. Thanks, Nathan Reed

Nov 22 2007
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Robert Fraser" <fraserofthenight gmail.com> wrote in message 
news:fi4nbg$28s3$2 digitalmars.com...

 Isn't that what snn.lib is?

That's Digital Mars libc.
Nov 22 2007
prev sibling parent Nathan Reed <nathaniel.reed gmail.com> writes:
Nathan Reed wrote:
 AnIHiL wrote:
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegQueryValueExA 24
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegCloseKey 4
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegQueryInfoKeyA 48
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegCreateKeyExA 36
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegOpenKeyExA 20
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegOpenKeyA 12
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegDeleteKeyA 8
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegSetValueExA 24
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegDeleteValueA 8
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegFlushKey 4
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegEnumKeyExA 32
 D:\D\dmd\lib\phobos.lib(registry)  Error 42: Symbol Undefined 
 _RegEnumValueA 32

These functions are in the Windows API, not part of phobos. I guess you need to link with some import libraries for user32.dll and/or kernel32.dll.

Oh and another thing, it looks like the functions are being name mangled, but the Windows API has a C interface, so the names shouldn't be mangled. I guess the declarations of these functions also need to be wrapped in extern(C). Maybe you are already linking with the right thing but it's not finding the functions due to the mangling issue. Thanks, Nathan Reed
Nov 22 2007
prev sibling next sibling parent AnIHiL <aanihill hotmail.com> writes:
Ok at last I figure it out :-)

If someone have problem with 
 OPTLINK (R) for Win32  Release 8.00.1
 Copyright (C) Digital Mars 1989-2004  All rights reserved.
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegQueryValueExA 24
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegCloseKey 4
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegQueryInfoKeyA 48
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegCreateKeyExA 36
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegOpenKeyExA 20
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegOpenKeyA 12
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegDeleteKeyA 8
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegSetValueExA 24
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegDeleteValueA 8
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegFlushKey 4
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegEnumKeyExA 32
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegEnumValueA 32
 --- errorlevel 12

than include library advapi32.lib from: ..\dm\lib\advapi32.lib AnIHiL Wrote:
 Hello,
 
 I copy one of the examples from GtkD project site:
 
 import gtk.MainWindow;
 import gtk.Label;
 import gtk.GtkD;
 
 void main(char[][] args)
 {
 	GtkD.init(args);
 	MainWindow win = new MainWindow("Hello World");
 	win.setDefaultSize(200, 100);
 	win.add(new Label("Hello World"));
 	win.showAll();
 
 	GtkD.main();
 }
 
 I use CodeBlock to compile it but I have an error. This is log from
compilation:
 
 -------------- Build: Debug in asd ---------------
 
 Compiling: hello.d
 Linking console executable: bin\Debug\asd.exe
 D:\D\dmd\bin\..\..\dm\bin\link.exe
obj\Debug\hello,bin\Debug\asd.exe,,D:\D\dmd\lib\phobos.lib+D:\D\dsss-0.73-dmd-win\lib\DD-atk.lib+D:\D\dsss-0.73-dmd-win\lib\DD-cairoLib.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gdk.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gdkpixbuf.lib+D:\D\dsss-0.73-dmd-win\lib\DD-glade.lib+D:\D\dsss-0.73-dmd-win\lib\DD-glib.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gobject.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gthread.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gtk.lib+D:\D\dsss-0.73-dmd-win\lib\DD-gtkc.lib+D:\D\dsss-0.73-dmd-win\lib\DD-pango.lib+user32+kernel32/noi;
 OPTLINK (R) for Win32  Release 8.00.1
 Copyright (C) Digital Mars 1989-2004  All rights reserved.
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegQueryValueExA 24
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegCloseKey 4
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegQueryInfoKeyA 48
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegCreateKeyExA 36
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegOpenKeyExA 20
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegOpenKeyA 12
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegDeleteKeyA 8
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegSetValueExA 24
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegDeleteValueA 8
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegFlushKey 4
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegEnumKeyExA 32
 D:\D\dmd\lib\phobos.lib(registry) 
  Error 42: Symbol Undefined _RegEnumValueA 32
 --- errorlevel 12
 Process terminated with status 12 (0 minutes, 0 seconds)
 12 errors, 0 warnings
 
 This is my sc.ini file:
 [Version]
 version=7.51 Build 020
 
 [Environment]
 LIB=D:\d\dm\lib;D:\d\dmd\lib
 DFLAGS="-I% P%\..\src\phobos" -Id:\d\dmd\import
-Id:\D\dsss-0.73-dmd-win\include\d
 LINKCMD=% P%\..\..\dm\bin\link.exe
  
 I already added in CodeBlock GtkD librarys and phobos library but this code
doesn't work. 
 
 Can someone help me ?
 

Nov 22 2007
prev sibling parent Dejan Lekic <dejan.lekic gmail.com> writes:
This is not a Phobos problem.
Nov 25 2007