www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Using packages: undefined reference to main

reply cloutiy <yves.cloutier gmail.com> writes:
I'd like to try making a simple web app using vibrant.d, however 
I don't think I'm using it correctly since I'm getting a linking 
error when compiling.

Below is my SDL with added vibrant.d dependency:

name "cvmaker"
description "A simple vibe.d server application."
authors "drifter"
copyright "Copyright © 2017, drifter"
license "proprietary"
dependency "vibrant-d" version="~>0.1.6"

I modified the default app.d created by dub init --type=vibe.d to:

import vibrant.d;

shared static this()
{
     with(Vibrant)
     {
         Get("/hello", (req, res) => "Hello World!");
     }
}

However I get a linking error when running the command 'dub' in 
my project folder:

Linking...
/usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/crt1.o: In 
function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
dmd failed with exit code 1.

I haven't been using d for very long yet and realize I may not be 
using external packages properly. I suspect it's a simple error 
on my part.
Mar 16 2017
parent reply bachmeier <no spam.net> writes:
On Thursday, 16 March 2017 at 17:55:13 UTC, cloutiy wrote:
 I'd like to try making a simple web app using vibrant.d, 
 however I don't think I'm using it correctly since I'm getting 
 a linking error when compiling.

 Below is my SDL with added vibrant.d dependency:

 name "cvmaker"
 description "A simple vibe.d server application."
 authors "drifter"
 copyright "Copyright © 2017, drifter"
 license "proprietary"
 dependency "vibrant-d" version="~>0.1.6"
[...] You might want to try the vibe.d forum: http://forum.rejectedsoftware.com/
Mar 17 2017
parent cloutiy <yves.cloutier gmail.com> writes:
On Friday, 17 March 2017 at 16:16:00 UTC, bachmeier wrote:
 On Thursday, 16 March 2017 at 17:55:13 UTC, cloutiy wrote:
 I'd like to try making a simple web app using vibrant.d, 
 however I don't think I'm using it correctly since I'm getting 
 a linking error when compiling.

 Below is my SDL with added vibrant.d dependency:

 name "cvmaker"
 description "A simple vibe.d server application."
 authors "drifter"
 copyright "Copyright © 2017, drifter"
 license "proprietary"
 dependency "vibrant-d" version="~>0.1.6"
[...] You might want to try the vibe.d forum: http://forum.rejectedsoftware.com/
Great, thanks for the tip bachmeier. I'll give it a try over there. Regards.
Mar 17 2017