Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 29, 2006, 10:21 PM   #1
ScKaSx
macrumors regular
 
Join Date: Feb 2006
Compiling XWindows in Xterm

Hi All,

I'm using Xterm to try and write a basic program for the X Windows system that creates a window and draws a line. However, I can't compile the program in the following way:

g++ XWinCode.cc

The error I get is:

ld:Undefined Symbols:
_XCreateGC
_XCreateSimpleWindow
....etc

In my code I include <X11/Xlib.h>, <assert.h>, <unistd.h>. Using "locate" I know these files exist. What am I doing wrong? Thanks

Cheers,
ScKaSx
ScKaSx is offline   0 Reply With Quote
Old Jun 29, 2006, 11:51 PM   #2
John Jacob
macrumors 6502a
 
John Jacob's Avatar
 
Join Date: Feb 2003
Location: Bangalore, India
Send a message via Yahoo to John Jacob Send a message via Skype™ to John Jacob
Quote:
Originally Posted by ScKaSx
g++ XWinCode.cc

The error I get is:

ld:Undefined Symbols:
_XCreateGC
_XCreateSimpleWindow
....etc
You need to tell g++ which libraries to link to resolve these symbols.

Try
g++ XWinCode.cc -lX11

If that doesn't work then
g++ XWinCode.cc -L/usr/X11R6/lib -lX11
(replace /usr/X11R6/lib with the appropriate path to the X11 library files - I'm at work and don't have nmy PB with me so I can't say what the path is on a Mac).
John Jacob is offline   0 Reply With Quote
Old Jun 30, 2006, 02:43 AM   #3
ScKaSx
Thread Starter
macrumors regular
 
Join Date: Feb 2006
Hi John,

Thanks the second one worked to perfection. Thanks again.

Cheers
ScKaSx is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Help compiling/running graphics in terminal dflem11 Mac Programming 2 Nov 8, 2010 02:42 PM
Compilations appear in *both* Albums and Compilation Lists? swiwchar iPod 2 Sep 20, 2006 11:05 PM
Compiling GTK in Xterm ScKaSx Mac Programming 15 Jul 19, 2006 10:42 AM
Can you compile this in XCode? (const class initialization) ksz General Mac Discussion 12 Nov 4, 2003 09:13 PM
How do i compile Java in OSX? jethroted Mac Applications and Mac App Store 19 Jun 4, 2003 06:42 PM


All times are GMT -5. The time now is 10:58 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC