LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-02-2006, 10:23 PM   #16
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30

ok brainwash
gcc can't link C++ modules at link time
g++ can't accept read and write API when the function they reside in is C e.g.
int do_somthing(void)
{
read(...);
}

Thanks
Jack
 
Old 01-02-2006, 10:42 PM   #17
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
Hi,
I can now use this to compile
gcc -o test test.cpp -lstdc++

How do I make autoconf discard g++ and use gcc?
Does anyone know the name of the Macro specified to configure.in?
Thanks
Jack
 
Old 01-03-2006, 02:01 AM   #18
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
After a day of juggling, I squeezed everything into one error
#include <X11/Xlib.h> <---- not found

I have setup the path in Makefile.am

$INCLUDES=-I$/opt/.... -$I/usr/X11R6/include

the file exist from that folder
Xlib.h


and only cross-compilation had this error, local PC Compilation was fine.

Anything I'm missing here?
Anyone? Paul?
Thanks
Jack
 
Old 01-03-2006, 10:20 PM   #19
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
Even in PC Linux mode, Xlib.h wasn't recognised.
I assume that I have to rename the extension from cpp to c which was what I did for other modules. Any comments?
Thanks
Jack
 
Old 01-03-2006, 11:16 PM   #20
mhcox
Member
 
Registered: Aug 2005
Location: Albuquerque, NM
Distribution: Fedora
Posts: 30

Rep: Reputation: 15
Quote:
Originally Posted by lucky6969b
After a day of juggling, I squeezed everything into one error
#include <X11/Xlib.h> <---- not found

I have setup the path in Makefile.am

$INCLUDES=-I/opt/.... -I/usr/X11R6/include

the file exist from that folder
Xlib.h


and only cross-compilation had this error, local PC Compilation was fine.

Anything I'm missing here?
Anyone? Paul?
Thanks
Jack
I'm not that familiar with automake/autoconfig, but my guess is that:

$INCLUDES=-I$/opt/.... -$I/usr/X11R6/include

should be:

INCLUDES=-I/opt/.... -I/usr/X11R6/include

Last edited by mhcox; 01-03-2006 at 11:19 PM.
 
Old 01-04-2006, 12:21 AM   #21
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
Mike Thanks for your kind reply.
I now got link time error against libjpeg
Thanks
Jack
 
Old 01-04-2006, 12:23 AM   #22
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
And #include <X11/Xlib.h>
still cause errors
If I comment it out, I don't have any compilation error
just link time error
Thanks
Jack
 
Old 01-04-2006, 12:28 AM   #23
mhcox
Member
 
Registered: Aug 2005
Location: Albuquerque, NM
Distribution: Fedora
Posts: 30

Rep: Reputation: 15
Quote:
Originally Posted by lucky6969b
And #include <X11/Xlib.h>
still cause errors
If I comment it out, I don't have any compilation error
just link time error
Thanks
Jack
What are the compilation/link error messages now?
 
Old 01-04-2006, 02:05 AM   #24
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
just can't get functions like jpeg_decompress... to link
Thanks
Jack
 
Old 01-04-2006, 08:39 PM   #25
mhcox
Member
 
Registered: Aug 2005
Location: Albuquerque, NM
Distribution: Fedora
Posts: 30

Rep: Reputation: 15
I repeat...

What are the compilation/link error messages now?

Also, is the library a C or C++ library? I assume it's C, since you mentioned only one function. Take a look at the headers that declare the functions. Is the header file "C++ aware", i.e. conditionally compiles 'extern "C"' blocks if the header is being compiled by a C++ compiler? If not, you'll have to put

extern "C"
{
#include "whatever_header.h"
}

In your code.
 
Old 01-04-2006, 08:51 PM   #26
lucky6969b
Member
 
Registered: Nov 2005
Posts: 337

Original Poster
Rep: Reputation: 30
Webcam.o(.text+0x2c):/opt/arcom/armbe-linux/include/c++/3.4.2/bits/basic_string.h:1983: undefined reference to 'jpeg_CreateDecompress(jpeg_decompress_struct*, int, unsigned int)'

etc...
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't compile c++ code with g++ malb Programming 5 07-25-2005 06:54 PM
how i compile a source code? nazib Linux - General 5 02-27-2005 09:13 AM
why cant i compile my c++ code in Mdk9.1 m_dma Mandriva 9 01-09-2004 08:36 PM
c++ code how to compile and iostream.h saavik Programming 5 09-03-2002 08:30 AM
How to compile source code... Grim Reaper Linux - Newbie 3 04-26-2002 11:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration