Re: Make Q's

2009-09-18 Thread Derek Atkins
Joshua Judson Rosen roz...@geekspace.com writes: project_SOURCES = file1.c file2.c \ file3.cpp file4.cpp file5.cpp file6.cpp file7.cpp # (NOTE: project_SOURCES should also include # any corresponding header-files) Actually, no, you should use: project_HEADERS = file1.h

Re: Make Q's

2009-09-18 Thread bruce . labitt
Here is a copy of my makefile. It is a lot easier for someone to help, if they can see what I'm doing... I just noticed the CC and lack of CXX, I'll fix that. # Makefile for tcp_fft_server # Date: Fri 18 Sep 2009 10:13:54 AM EDT # Author: Bruce Labitt bruce.lab...@autoliv.com # Dependencies

Re: Make Q's

2009-09-18 Thread Derek Atkins
bruce.lab...@autoliv.com writes: [snip] myfft.o:(.text+0x198): undefined reference to `memcpy_cell(void*, void const*, unsigned long)' [snip] myserver.o:(.text+0xd58): undefined reference to `pack(unsigned char*, char*, ...)' [snip] myserver.o:(.text+0xf74): undefined reference to

Re: Make Q's

2009-09-18 Thread Kevin D. Clark
Derek Atkins writes: Perhaps you need an 'extern C' in there so C++ knows how to call the C functions? To cut to the chase, Bruce probably should make sure that all of his C functions are declared in C-specific header files that have the following pattern: #ifndef UTIL_H #define UTIL_H

Re: Make Q's

2009-09-18 Thread Joshua Judson Rosen
Derek Atkins warl...@mit.edu writes: Joshua Judson Rosen roz...@geekspace.com writes: project_SOURCES = file1.c file2.c \ file3.cpp file4.cpp file5.cpp file6.cpp file7.cpp # (NOTE: project_SOURCES should also include # any corresponding header-files) Actually, no, you

Re: Make Q's

2009-09-18 Thread bruce . labitt
Derek Atkins warl...@mit.edu wrote on 09/18/2009 11:55:27 AM: bruce.lab...@autoliv.com writes: [snip] myfft.o:(.text+0x198): undefined reference to `memcpy_cell(void*, void const*, unsigned long)' [snip] myserver.o:(.text+0xd58): undefined reference to `pack(unsigned char*,

Re: Make Q's

2009-09-18 Thread Michael ODonnell
As an experiment, can you link a helloWorld-style object (that needs the symbols in question) against the libs in question? In other words, arrange for that memcpy_cell(void*,blah,blah) to be unresolved in your helloWorld object and then link it against the object or lib you think should be

Re: Make Q's

2009-09-18 Thread bruce . labitt
gnhlug-discuss-boun...@mail.gnhlug.org wrote on 09/18/2009 12:16:15 PM: Derek Atkins writes: Perhaps you need an 'extern C' in there so C++ knows how to call the C functions? To cut to the chase, Bruce probably should make sure that all of his C functions are declared in C-specific

Re: Make Q's

2009-09-18 Thread Peter Dobratz
#ifndef UTIL_H #define UTIL_H #ifdef __cplusplus extern C { #endif void some_function_with_c_linkage(); #ifdef __cplusplus } #endif #endif  /* UTIL_H */ Could you explain why this is necessary, and what it does?  What is necessary to use this? C compilers do not name mangle

Re: Make Q's

2009-09-18 Thread Joshua Judson Rosen
bruce.lab...@autoliv.com writes: gnhlug-discuss-boun...@mail.gnhlug.org wrote on 09/18/2009 12:16:15 PM: Derek Atkins writes: Perhaps you need an 'extern C' in there so C++ knows how to call the C functions? To cut to the chase, Bruce probably should make sure that all of his

Re: Make Q's

2009-09-18 Thread Kevin D. Clark
bruce.labitt writes: I've not seen this type of code before. I wonder why all of my previous code even works. Surely it is a way to do it. Is there a simpler way? (Not that the above is hard by any means.) Can you tell us, which books on C and C++ do you have in your work area right now?

Re: Make Q's

2009-09-18 Thread bruce . labitt
peter.dobr...@gmail.com wrote on 09/18/2009 02:52:40 PM: #ifndef UTIL_H #define UTIL_H #ifdef __cplusplus extern C { #endif void some_function_with_c_linkage(); #ifdef __cplusplus } #endif #endif /* UTIL_H */ Could you explain why this is necessary, and what

Re: Make Q's

2009-09-18 Thread bruce . labitt
gnhlug-discuss-boun...@mail.gnhlug.org wrote on 09/18/2009 03:23:14 PM: bruce.labitt writes: I've not seen this type of code before. I wonder why all of my previous code even works. Surely it is a way to do it. Is there a simpler way? (Not that the above is hard by any means.)

Re: Make Q's

2009-09-18 Thread Kevin D. Clark
bruce.lab...@autoliv.com writes: Kevin Clark wrote: bruce.labitt writes: I've not seen this type of code before. I wonder why all of my previous code even works. Surely it is a way to do it. Is there a simpler way? (Not that the above is hard by any means.) Can you tell

Re: Make Q's

2009-09-17 Thread Lloyd Kvam
On Wed, 2009-09-16 at 23:28 -0400, Kevin D. Clark wrote: Look, I could write a big writeup here, giving you a complete example of a Makefile that is similar to what I know you are looking for, but in actuality let me just tell you that I happen to be a big fan of the GNU Make manual. I think

Re: Make Q's

2009-09-17 Thread bruce . labitt
On Wed, 2009-09-16 at 23:28 -0400, Kevin D. Clark wrote: Look, I could write a big writeup here, giving you a complete example of a Makefile that is similar to what I know you are looking for, but in actuality let me just tell you that I happen to be a big fan of the GNU Make manual. I

Re: Make Q's

2009-09-17 Thread Derek Atkins
bruce.lab...@autoliv.com writes: On Wed, 2009-09-16 at 23:28 -0400, Kevin D. Clark wrote: Look, I could write a big writeup here, giving you a complete example of a Makefile that is similar to what I know you are looking for, but in actuality let me just tell you that I happen to be a big

Re: Make Q's

2009-09-17 Thread bruce . labitt
Derek Atkins warl...@mit.edu wrote on 09/17/2009 10:25:44 AM: bruce.lab...@autoliv.com writes: Nonetheless, allow me to ask for a critique (do I dare?) for this construct: CC=g++ CCOPTS= INCLUDES= DEPS= %.o: %.cpp $(DEPS) $(CC) -c $ $(CCOPTS) $(INCLUDES) This

Re: Make Q's

2009-09-17 Thread Kevin D. Clark
bruce.lab...@autoliv.com writes: There are two files that need to be compiled with gcc, and five with g++. (completely un-tested) MYFLAGS=-g -Werror -Wall -Wcast-qual CFLAGS=$(MYFLAGS) CXXFLAGS=$(MYFLAGS) # we define _XOPEN_SOURCE because # we define _GNU_SOURCE because # modify to

Re: Make Q's

2009-09-17 Thread bruce . labitt
kevin_d_cl...@comcast.net (Kevin D. Clark) wrote on 09/17/2009 12:03:20 PM: bruce.lab...@autoliv.com writes: There are two files that need to be compiled with gcc, and five with g++. (completely un-tested) MYFLAGS=-g -Werror -Wall -Wcast-qual CFLAGS=$(MYFLAGS) CXXFLAGS=$(MYFLAGS)

Re: Make Q's

2009-09-17 Thread Kevin D. Clark
bruce.labitt writes: Kevin D. Clark wrote on 09/17/2009 12:03:20 PM: # we define _XOPEN_SOURCE because # we define _GNU_SOURCE because # modify to suit to your situation CPPFLAGS=-D_XOPEN_SOURCE=500 -D_GNU_SOURCE where are CPPFLAGS used below? They're not ; my example

Re: Make Q's

2009-09-17 Thread Joshua Judson Rosen
bruce.lab...@autoliv.com writes: There are two files that need to be compiled with gcc, and five with g++. One could set up two objects lists, OBJ1=file1.o file2.o== use gcc OBJ2=file3.o file4.o file5.o file6.o file7.o== use g++ SRC1=file1.c

Make Q's

2009-09-16 Thread Bruce Labitt
I made a make file for my project. It was kind of ugly, but it nearly works... First moderately complicated make I've done. Three questions: 1. Is it possible to have a project that some files are compiled with g++ and others gcc? 2. In the link phase one needs to use g++, correct? 3. Is

Re: Make Q's

2009-09-16 Thread Kevin D. Clark
Bruce Labitt writes: Three questions: 1. Is it possible to have a project that some files are compiled with g++ and others gcc? Yes. I do this all the time. 2. In the link phase one needs to use g++, correct? Yes, if you are trying to link together a collection of C and C++ files and