XWindows programming + gcc linker options


 
Thread Tools Search this Thread
Top Forums Programming XWindows programming + gcc linker options
# 1  
Old 06-24-2008
XWindows programming + gcc linker options

Im trying to compile some code that involves using X-Windows based functions (XDisplayName() and XOpenDisplay() ), however each time I run the compiler, Im getting a problem with the linker.

The linker says that both XDisplayName() and XOpenDisplay() are unresolved text symbols. Is there a specific option I should be specifying in the compile command for the X-Windows functions to be legitimately recognised ?

Warm Regards
# 2  
Old 06-24-2008
Never mind, I figured it out thru some trial and error (a bit of reading on the way :P)

For those interested, whenever you compile a program (which contains XWindows-based functions) in gcc, do the following

Code:
gcc  -compiler options  myprogram.c  -o  myprogram  -lX11

-lX11 is the linking option you need to be able to use XWindows based functions
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Help with gcc programming

I need a lot of help with c programming. I have the source code. Running configure, I got one error message about a missing library. I downloaded and successfully compiled it in another dir. Do I throw all the new files into my source dir and run configure again ? Thanks. (3 Replies)
Discussion started by: drew77
3 Replies

2. Programming

Gcc openmp programming problem

Dear Linux users, I'm a noob at openmp, gcc and c programming. I can run my own openmp code in terminal with no problem, eg. gcc -fopenmp program.c -o program. But now I'm trying to compile and run another person's code, it contains a makefile and multiple .c and .h files. I don't know how to... (2 Replies)
Discussion started by: pigeon151
2 Replies

3. Programming

Gcc linker search path order

I have a build where I wish to link against and load a specific version of a library and a different version of the same library is installed on the system. I'm using a -L option to point to the version that I wish to link against but gcc still seems to choose the installed version. Is there a way... (4 Replies)
Discussion started by: Richard Johnson
4 Replies

4. Programming

gcc linker address

Hai, I have two (Pgm1.c and Pgm2.c) simple programs, which is compiled using gcc. Now we have two exe's (Pgm1 and Pgm2). When i executed the nm Pgm1 and nm Pgm2, in the listed symbols the address of main is same for both programs (08048344 T main) at run time also. Doubt: 1) What is this... (3 Replies)
Discussion started by: rajamohan
3 Replies

5. AIX

xlc compiler options versus gcc

Hi all, I would like to compile a program and get current errors and warnings report to me as « gcc -Wall ». Does someone can give me these options to get an equivalent ? Or the ommon option used to put them in a CFLAGS in a Makefile. Something like : xlc -O2 -Wall my_prog.c -o... (5 Replies)
Discussion started by: domiq44
5 Replies

6. Programming

GCC: Choose my own linker

Hi, I do not use the default linker, and instead us another one and pass this argument -Wl,--dynamic-linker=<path to linker> to gcc when compiling. However, what happens if the linker is not under /lib and /lib64 and I am not able to create a symlink to the linker in /lib or /lib64 due to no... (2 Replies)
Discussion started by: Shompis
2 Replies

7. Solaris

gcc & linker question (Solaris 10)

Hi, I'm confused about the GCC & Linking process could somebody please briefly explain? I have GCC 3.4.6 installed from SunFreeware. Reading the narrative alongside the package states "It was compiled to use the SUN assembler and loader usually in /usr/ccs/bin if the SUNW developer packages... (1 Reply)
Discussion started by: Celtic_Monkey
1 Replies

8. UNIX for Dummies Questions & Answers

programming options

I am working on a community college certification in programming and have a choice of specialization in Java ,Visual Basic ,or Visual C++. I am curious to know what specialization would be best for the current job market and increase my earning potential? Any feedback would be greatly... (5 Replies)
Discussion started by: bilal_aa
5 Replies
Login or Register to Ask a Question