[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

undefined reference

From: rrlangly
Subject: undefined reference
Date: Thu, 25 Feb 2010 11:15:13 -0800 (PST)


This is a small test case I wrote in which I can't understand why I have an
undefined reference. I have an undefined reference which I thought only
requires linking w/ the libs that contain this symbol, which I am. The
function dm_connect() is in the library libdm, and this is on the g++
command line when I compile as shown. The libdm is a C library and I'm
calling this in my C++ program.

Can anyone help me understand what I'm doing wrong?

--- Compile and Error

$ g++ $(pkg-config --cflags glib-2.0) -I/usr/include -I/usr/local/include
-I/home/joe/Projects/net-1.0/util -L/usr/local/lib
-L/home/joe/Projects/net-1.0/libdm $(pkg-config --libs glib-2.0) -ldm
/tmp/ccksTRGA.o: In function `main':
main.cpp:(.text+0x30): undefined reference to `dm_connect(char*, unsigned
collect2: ld returned 1 exit status

--- Source 
#include <stdio.h>

#include "gxclient.h"

using namespace std;

int main ()
    int fd = -1;

    uint16_t port = 11002;

    char *dmhostname = "localhost";

    fd = dm_connect(dmhostname, port);

    if (fd < 0) {
    return 0;

View this message in context:
Sent from the gcc - Gnu Help List mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]