LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-13-2011, 11:28 AM   #1
aydi
LQ Newbie
 
Registered: Jul 2011
Posts: 7

Rep: Reputation: Disabled
makefile


hello,

i have this make file that i want to use to test hello world:
Code:
CC=	$(shell which ppc_4xx-g++) 
CXXFLAGS=-cpp -Wall	
LDFLAGS=	
SOURCES=main.cpp hello.h	
OBJECTS=$(SOURCES:.cpp=.o)	
EXECUTABLE=hello	

all: $(SOURCES) $(EXECUTABLE)	
	
$(EXECUTABLE): $(OBJECTS)	
	$(CC) $(LDFLAGS) $(OBJECTS) -o $@	

.cpp.o:
	$(CC) $(CXXFLAGS) $< -o $@
and hello.h:

Code:
#include <iostream.h>
using namespace std;
void hello(){
   cout << "Hello World!";
}
and main.cpp:

Code:
#include <iostream.h>
#include "hello.h"
using namespace std;
int main(){
    hello();
    cout << endl;
    //cout << "The factorial of 5 is " << factorial(5) << endl;
    return 0;
}
i get a lot of message like that:

main.o:/opt/eldk/build/ppc-2008-04-01/work/usr/src/denx/BUILD/crosstool-0.43/build/gcc-4.2.2-glibc-20070515T2025-eldk/powerpc-linux/build-gcc/gcc/crtsavres.S:283: first defined here
collect2: ld returned 1 exit status
make: *** [hello] Erreur 1

i don't understand what's the problem

can any one help me to solve this problem.

thanks an advance
 
Old 07-13-2011, 12:37 PM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,124

Rep: Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779
Quote:
CC= $(shell which ppc_4xx-g++)
Are you building this for a machine that is based upon Power PC (processor)? Based upon the error message, it looks like you are invoking a cross compiler (crosstool-0.43).
The error message appears to be a linker message, possibly about duplicate defined symbols. Are you able to compile and link without a makefile?
 
Old 07-13-2011, 12:52 PM   #3
aydi
LQ Newbie
 
Registered: Jul 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
thank you
i solve the pb
 
Old 07-13-2011, 01:41 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,565

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
Quote:
i solve the pb
So please share so others may learn?

You also need to mark your thread as SOLVED.
 
Old 07-13-2011, 04:33 PM   #5
aydi
LQ Newbie
 
Registered: Jul 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Code:
CC= $(shell which ppc_4xx-g++)
CXXFLAGS=-c++ -Wall
LDFLAGS=
SOURCES=main.cpp hello.h
OBJECTS=$(SOURCES:.c++=.o)
EXECUTABLE=hello

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@

.cpp.o:
$(CC) $(CXXFLAGS) $< -o $@
this the mexfile for ppc.

for the standard library just keep: #include <iostream> without "h"

it works

good luck
 
Old 07-13-2011, 07:48 PM   #6
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,565

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
Thanks for the update, but you still need to mark as SOLVED.
 
Old 07-15-2011, 03:35 AM   #7
aydi
LQ Newbie
 
Registered: Jul 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
thanks'.

it's solved.

thanks
 
Old 07-15-2011, 03:49 AM   #8
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,565

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
Yes and if you go to Thread Tools at the top of the page and mark it as such it will advise everyone that it is SOLVED.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
make: Warning: Both `makefile' and `Makefile' exist ? malli42108 Solaris / OpenSolaris 5 10-24-2009 10:09 AM
Is it mandatory to have the name of the makefile as 'Makefile' for kernal module comp narender.d Linux - Kernel 3 05-29-2009 07:26 AM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 04:57 AM
generate Makefile from Makefile.in without calling ./configure ? chris78 Programming 2 05-02-2004 01:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:51 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration