[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: makefile & include problems




It turned out to be the -ansi compiler option that is set by default on
CFLAGS and CXXFLAGS

Matt



                                                                                        
                    matthew.hook@r                                                      
                    ds.co.nz              To:     dev-etrax@xxxxxxx.com                    
                    Sent by:              cc:                                           
                    owner-dev-etra        Subject:     makefile & include problems      
                    x@xxxxxxx.com                                                          
                                                                                        
                                                                                        
                    23/04/01 12:24                                                      
                    PM                                                                  
                                                                                        
                                                                                        




Can someone please shed light onto the following problem I am having.

I have software that I'm porting to the Etrax platform.

It compiles fine and without any errors or warnings on Redhat Linux 6.2

If I create an makefile for the etrax platform and "make host", even simple
things fail.   e.g.

#include <string.h>
#include <stdlib.h>

void useless()
{
    char * x = strdup("hello");
    free(x);
}

g++ -Wall -O0 -g -Wno-ctor-dtor-privacy -ansi -pipe -fcheck-new -Dlinux -c
-o Test.o Test.cpp
Test.cpp: In function `void useless()':
Test.cpp:6: warning: implicit declaration of function `int strdup(...)'
Test.cpp:6: warning: initialization to `char *' from `int' lacks a cast

The problem appears to be when using the C functions from C++.  I tried
placing extern "C" around
the includes for string and stdlib but that did not help.

I have had the same problems with defines such as CBAUD and FNDELAY.

Has anyone had similar problems with C++ when trying to use "make host"?

Now the weird part.  It compiles without any errrors at all when using
"make elinux", which is what I
want anyway.

All this seems to go away when using host based makefiles, i.e. not
including Rules.elinux.

It's a bit annoying though to have to create a completely separate makefile
for testing the software
on the Host platform and then another one for the etrax platform.

Matt.