www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ide - Using libraries in VisualD

reply "Nikos" <jna mail.gr> writes:
I can't find how to use other libraries than Phobos in VisualD. 
How to reference them?
Mar 06 2014
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 07.03.2014 00:24, Nikos wrote:
 I can't find how to use other libraries than Phobos in VisualD. How to
 reference them?
If you are building the library yourself in another project in Visual Studio, just add a project dependency and it will be added to the linker command line. Otherwise you should add it to the "Library Files" option on the linker page of the project configuration. If you mean to replace the default phobos library, you might have to add -L/NODEFAULTLIB:phobos to the command line.
Mar 07 2014
parent reply "Zaggy1024" <Zaggy1024 gmail.com> writes:
On Friday, 7 March 2014 at 08:09:54 UTC, Rainer Schuetze wrote:
 On 07.03.2014 00:24, Nikos wrote:
 I can't find how to use other libraries than Phobos in 
 VisualD. How to
 reference them?
If you are building the library yourself in another project in Visual Studio, just add a project dependency and it will be added to the linker command line. Otherwise you should add it to the "Library Files" option on the linker page of the project configuration. If you mean to replace the default phobos library, you might have to add -L/NODEFAULTLIB:phobos to the command line.
Just thought I'd post this in a related existing thread. I've tried numerous ways to include DSFML (a D binding for SFML), but I can't seem to get it to work. I expect I'm doing something stupid somewhere along the way, but I haven't been able to figure out what. I tried putting this in the Library Files field in the linker settings: "C:\DSFML\prebuilt\dsfml-system.lib;C:\DSFML\prebuilt\dsfml-window.lib;C:\DSFML\prebuilt\dsfml-network.lib;C:\DSFML\prebuilt\dsfml-graphics.lib;C:\DSFML\prebuilt\dsfml-audio.lib" But when I try using "import dsfml.system.sleep;" to import a part of the library, it spouts this: "main.d(3): Error: module sleep is in file 'dsfml\system\sleep.d' which cannot be read" If anyone knows what I'm doing wrong, I'd appreciate the help. :)
Apr 03 2014
parent reply Mike Parker <aldacron gmail.com> writes:
On 4/4/2014 8:45 AM, Zaggy1024 wrote:

 I tried putting this in the Library Files field in the linker settings:

 "C:\DSFML\prebuilt\dsfml-system.lib;C:\DSFML\prebuilt\dsfml-window.lib;C:\DSFML\prebuilt\dsfml-network.lib;C:\DSFML\prebuilt\dsfml-graphics.lib;C:\DSFML\prebuilt\dsfml-audio.lib"


 But when I try using "import dsfml.system.sleep;" to import a part of
 the library, it spouts this:

 "main.d(3): Error: module sleep is in file 'dsfml\system\sleep.d' which
 cannot be read"

 If anyone knows what I'm doing wrong, I'd appreciate the help. :)
You haven't configured your import path. The libraries are for the linker, but you need the source modules on the import path for the compiler. So assuming C:\dev\source\dsfml, you'll need to put C:\dev\source somewhere in the compiler settings.
Apr 03 2014
parent reply "Zaggy1024" <Zaggy1024 gmail.com> writes:
On Friday, 4 April 2014 at 00:44:52 UTC, Mike Parker wrote:
 On 4/4/2014 8:45 AM, Zaggy1024 wrote:

 I tried putting this in the Library Files field in the linker 
 settings:

 "C:\DSFML\prebuilt\dsfml-system.lib;C:\DSFML\prebuilt\dsfml-window.lib;C:\DSFML\prebuilt\dsfml-network.lib;C:\DSFML\prebuilt\dsfml-graphics.lib;C:\DSFML\prebuilt\dsfml-audio.lib"


 But when I try using "import dsfml.system.sleep;" to import a 
 part of
 the library, it spouts this:

 "main.d(3): Error: module sleep is in file 
 'dsfml\system\sleep.d' which
 cannot be read"

 If anyone knows what I'm doing wrong, I'd appreciate the help. 
 :)
You haven't configured your import path. The libraries are for the linker, but you need the source modules on the import path for the compiler. So assuming C:\dev\source\dsfml, you'll need to put C:\dev\source somewhere in the compiler settings.
Thanks for the help. I put the source location into "Additional Imports", and it gave this error: "Error 42: Symbol Undefined _D5dsfml6system5sleep12__ModuleInfoZ" I tried removing the linker's library files, but the error stayed the same.
Apr 03 2014
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Friday, 4 April 2014 at 02:56:08 UTC, Zaggy1024 wrote:
 On Friday, 4 April 2014 at 00:44:52 UTC, Mike Parker wrote:
 On 4/4/2014 8:45 AM, Zaggy1024 wrote:

 I tried putting this in the Library Files field in the linker 
 settings:

 "C:\DSFML\prebuilt\dsfml-system.lib;C:\DSFML\prebuilt\dsfml-window.lib;C:\DSFML\prebuilt\dsfml-network.lib;C:\DSFML\prebuilt\dsfml-graphics.lib;C:\DSFML\prebuilt\dsfml-audio.lib"


 But when I try using "import dsfml.system.sleep;" to import a 
 part of
 the library, it spouts this:

 "main.d(3): Error: module sleep is in file 
 'dsfml\system\sleep.d' which
 cannot be read"

 If anyone knows what I'm doing wrong, I'd appreciate the 
 help. :)
You haven't configured your import path. The libraries are for the linker, but you need the source modules on the import path for the compiler. So assuming C:\dev\source\dsfml, you'll need to put C:\dev\source somewhere in the compiler settings.
Thanks for the help. I put the source location into "Additional Imports", and it gave this error: "Error 42: Symbol Undefined _D5dsfml6system5sleep12__ModuleInfoZ" I tried removing the linker's library files, but the error stayed the same.
this may means that you must compile that dsfml(?) as library first and then link it with your code. because adding import paths only says to compiler that they are exists, but no actual code generated for them unless you put it in your build. i hope it clear enough now.
Apr 04 2014
parent reply "Zaggy1024" <Zaggy1024 gmail.com> writes:
On Friday, 4 April 2014 at 09:34:29 UTC, evilrat wrote:
 this may means that you must compile that dsfml(?) as library
 first and then link it with your code. because adding import
 paths only says to compiler that they are exists, but no actual
 code generated for them unless you put it in your build. i hope
 it clear enough now.
Isn't that what putting the path to the prebuilt .lib files in the linker configuration does?
Apr 04 2014
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Friday, 4 April 2014 at 15:58:47 UTC, Zaggy1024 wrote:
 On Friday, 4 April 2014 at 09:34:29 UTC, evilrat wrote:
 this may means that you must compile that dsfml(?) as library
 first and then link it with your code. because adding import
 paths only says to compiler that they are exists, but no actual
 code generated for them unless you put it in your build. i hope
 it clear enough now.
Isn't that what putting the path to the prebuilt .lib files in the linker configuration does?
"import path" is for .d/.di files, library path is for .lib
Apr 04 2014
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Friday, 4 April 2014 at 16:44:07 UTC, evilrat wrote:
 On Friday, 4 April 2014 at 15:58:47 UTC, Zaggy1024 wrote:
 On Friday, 4 April 2014 at 09:34:29 UTC, evilrat wrote:
 this may means that you must compile that dsfml(?) as library
 first and then link it with your code. because adding import
 paths only says to compiler that they are exists, but no 
 actual
 code generated for them unless you put it in your build. i 
 hope
 it clear enough now.
Isn't that what putting the path to the prebuilt .lib files in the linker configuration does?
"import path" is for .d/.di files, library path is for .lib
sorry for such obvious comment. i must say that library files is full path or just filename.lib, and library search path is where .lib's can be found. and keep in mind that most(if not all) project options are delimited with spacebars only, not semicolon. so if you have such paths like "C:\Some Location\lib;D:\other\lib" you shold try to split them like this "C:\Some Location\lib" D:\other\lib
Apr 04 2014
parent reply "Zaggy1024" <Zaggy1024 gmail.com> writes:
On Saturday, 5 April 2014 at 03:41:21 UTC, evilrat wrote:
 sorry for such obvious comment. i must say that library files 
 is full path or just filename.lib, and library search path is 
 where .lib's can be found. and keep in mind that most(if not 
 all) project options are delimited with spacebars only, not 
 semicolon.

 so if you have such paths like
 "C:\Some Location\lib;D:\other\lib"
 you shold try to split them like this
 "C:\Some Location\lib" D:\other\lib
I guess I should just show you how I have it set up right now... Compiler config: http://i.imgur.com/laRKpZM.png Linker config: http://i.imgur.com/CBdzNCO.png If I'm correct, it should be finding the .lib files from C:/DSFML/prebuilt, and the source in /src. Am I doing something wrong?
Apr 05 2014
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Saturday, 5 April 2014 at 14:40:49 UTC, Zaggy1024 wrote:
 On Saturday, 5 April 2014 at 03:41:21 UTC, evilrat wrote:
 sorry for such obvious comment. i must say that library files 
 is full path or just filename.lib, and library search path is 
 where .lib's can be found. and keep in mind that most(if not 
 all) project options are delimited with spacebars only, not 
 semicolon.

 so if you have such paths like
 "C:\Some Location\lib;D:\other\lib"
 you shold try to split them like this
 "C:\Some Location\lib" D:\other\lib
I guess I should just show you how I have it set up right now... Compiler config: http://i.imgur.com/laRKpZM.png Linker config: http://i.imgur.com/CBdzNCO.png If I'm correct, it should be finding the .lib files from C:/DSFML/prebuilt, and the source in /src. Am I doing something wrong?
you forgot to link libs :) add necessary .lib file names to "library files" field, in this case it should be something like "dsfml.lib" or whatever, there may be also multiple libs. p.s. you don't do any C/C++ ever, right? :)
Apr 05 2014
parent reply "Zaggy1024" <Zaggy1024 gmail.com> writes:
On Saturday, 5 April 2014 at 15:33:59 UTC, evilrat wrote:
 On Saturday, 5 April 2014 at 14:40:49 UTC, Zaggy1024 wrote:
 On Saturday, 5 April 2014 at 03:41:21 UTC, evilrat wrote:
 sorry for such obvious comment. i must say that library files 
 is full path or just filename.lib, and library search path is 
 where .lib's can be found. and keep in mind that most(if not 
 all) project options are delimited with spacebars only, not 
 semicolon.

 so if you have such paths like
 "C:\Some Location\lib;D:\other\lib"
 you shold try to split them like this
 "C:\Some Location\lib" D:\other\lib
I guess I should just show you how I have it set up right now... Compiler config: http://i.imgur.com/laRKpZM.png Linker config: http://i.imgur.com/CBdzNCO.png If I'm correct, it should be finding the .lib files from C:/DSFML/prebuilt, and the source in /src. Am I doing something wrong?
you forgot to link libs :) add necessary .lib file names to "library files" field, in this case it should be something like "dsfml.lib" or whatever, there may be also multiple libs. p.s. you don't do any C/C++ ever, right? :)
All right, I put the filenames for the library files in that field, with spaces separating them: http://i.imgur.com/kWBVUmp.png I'm still getting the same error as before. :\ In answer to your question, no, I don't do C++ programming, but I've learned Java and various other OO programming languages, and I wanted to try starting a project in a language that compiles to native code, and D seemed like a good option.
Apr 05 2014
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Saturday, 5 April 2014 at 16:33:21 UTC, Zaggy1024 wrote:
 On Saturday, 5 April 2014 at 15:33:59 UTC, evilrat wrote:
 On Saturday, 5 April 2014 at 14:40:49 UTC, Zaggy1024 wrote:
 On Saturday, 5 April 2014 at 03:41:21 UTC, evilrat wrote:
 sorry for such obvious comment. i must say that library 
 files is full path or just filename.lib, and library search 
 path is where .lib's can be found. and keep in mind that 
 most(if not all) project options are delimited with 
 spacebars only, not semicolon.

 so if you have such paths like
 "C:\Some Location\lib;D:\other\lib"
 you shold try to split them like this
 "C:\Some Location\lib" D:\other\lib
I guess I should just show you how I have it set up right now... Compiler config: http://i.imgur.com/laRKpZM.png Linker config: http://i.imgur.com/CBdzNCO.png If I'm correct, it should be finding the .lib files from C:/DSFML/prebuilt, and the source in /src. Am I doing something wrong?
you forgot to link libs :) add necessary .lib file names to "library files" field, in this case it should be something like "dsfml.lib" or whatever, there may be also multiple libs. p.s. you don't do any C/C++ ever, right? :)
All right, I put the filenames for the library files in that field, with spaces separating them: http://i.imgur.com/kWBVUmp.png I'm still getting the same error as before. :\ In answer to your question, no, I don't do C++ programming, but I've learned Java and various other OO programming languages, and I wanted to try starting a project in a language that compiles to native code, and D seemed like a good option.
you can actualy leave library search path as C:/DSFML/prebuilt and add library names "dsmfl-audio.lib" and other. but this error(something about module info) may be due different compiler versions(e.g. prebuild libs was built with dmd 2.064, and ur dmd is 2.065)(1), so you better rebuild that dsfml and try again. btw i recommend use dub[1] if you don't already. it is easy to maintain any changes with it, dub can generate VisualD projects, and mono-d could open dub packages directly. (1) module info changes almost every releas [1] http://code.dlang.org/download
Apr 05 2014
parent reply "Dmitry" <dmitry indiedev.ru> writes:
On Saturday, 5 April 2014 at 16:44:29 UTC, evilrat wrote:
 btw i recommend use dub[1] if you don't already. it is easy to 
 maintain any changes with it, dub can generate VisualD
Hi. (And at first, sorry for my bad English). I have same problem with same library :) It my first project in D. And first project with SFML (DSFML of course). I use dub for making Visual Studio project (I use VS2010). Then open it and set up project settings: general http://goo.gl/QuM2QE compiler http://goo.gl/6GR2VZ linker http://goo.gl/2XISxF Autocomplete works correctly. http://goo.gl/LQf13s When I try build project, here is error:
Error 42: Symbol Undefined _D5dsfml8graphics12__ModuleInfoZ
How I can resolve it?
 projects, and mono-d could open dub packages directly.
Btw, mono-d works and I alreday start project with it. But here I do not have option for debugging: http://goo.gl/NGZ3Oh (in Visual Studio debugger works fine).
May 14 2014
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Wednesday, 14 May 2014 at 08:51:00 UTC, Dmitry wrote:
 When I try build project, here is error:
Error 42: Symbol Undefined _D5dsfml8graphics12__ModuleInfoZ
How I can resolve it?
do you build it manually or use some kind of shipped .lib file? in latter case you'd better build it yourself.
May 16 2014
parent reply "Dmitry" <dmitry indiedev.ru> writes:
On Saturday, 17 May 2014 at 06:38:07 UTC, evilrat wrote:
 do you build it manually or use some kind of shipped .lib file? 
 in latter case you'd better build it yourself.
But this .lib works with mono-d correctly. When I try use myself builded .lib, I have 140 linker errors (Error 42: Symbol Undefined ...)
May 17 2014
parent reply "evilrat" <evilrat666 gmail.com> writes:
On Saturday, 17 May 2014 at 08:19:35 UTC, Dmitry wrote:
 On Saturday, 17 May 2014 at 06:38:07 UTC, evilrat wrote:
 do you build it manually or use some kind of shipped .lib 
 file? in latter case you'd better build it yourself.
But this .lib works with mono-d correctly. When I try use myself builded .lib, I have 140 linker errors (Error 42: Symbol Undefined ...)
dub tracks project dependencies and rebuild them automatically if needed. and since there is not only module info symbol "missing" it may be something wrong with VisualD path to this lib or link args.
May 17 2014
parent "Dmitry" <dmitry indiedev.ru> writes:
I understood problem. It needed to generate the project (dub 
generate visuald) each time after adding/changing dependencies in 
json. And then only add path to libs.

Little tutorial here 
https://stackoverflow.com/questions/23697532/dsfml-building-error-visuald/24074566
Jun 05 2014