Using packages: undefined reference to main

cloutiy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 16 10:55:13 PDT 2017


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.


More information about the Digitalmars-d-learn mailing list