[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) |
Hi,
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
main.cpp
/tmp/ccksTRGA.o: In function `main':
main.cpp:(.text+0x30): undefined reference to `dm_connect(char*, unsigned
short)'
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) {
printf("failed\n");
}
return 0;
}
--
View this message in context:
http://old.nabble.com/undefined-reference-tp27714505p27714505.html
Sent from the gcc - Gnu Help List mailing list archive at Nabble.com.
- undefined reference,
rrlangly <=