LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 04-28-2004, 10:36 AM   #1
kvtournh
Member
 
Registered: Nov 2003
Location: Belgium
Distribution: Mandriva
Posts: 91

Rep: Reputation: 15
g++ library problem stdc++


Hi
I have this sort of problem concerning libraries of c++. I know it is not exactly for mandrake section in this forum, but since it is because some files are missing or not found, and I use MDK9.2 I just put it here.

There is already a thread started concerning this problem in the program section, but it doesn't have a solution.

Anyway, when I compile my program with the line (I use g++ 3.3.1)
$ g++ -g -O2 -o outfile $(OBJECTFILES)
everything works out fine.
but when i want to include the libraries into my executable using the -static flag
$ g++ -g -O2 -static -o outfile $(OBJECTFILES)
I get the following error

/usr//bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

After a google search I found that I had to install the rpm
libstdc++5-static-devel-3.3.1-2mdk.i586.rpm

I did this and it gave as result the new error

/usr//bin/ld: cannot find -lm
collect2: ld returned 1 exit status

I have used in my cpp files the following headers
<iostream> <cmath> <complex> and <cstring>

does anybody has an idea how to solve this?
thanks

my makefile looks like this
Code:
# Version number 
VERSION = 0.1.0  

# Calculation path CPATH  = .  
# Compiler used CC      =  g++  
# Flags for the compiler 
OPTFLAG =	-O2 
STATIC  = 	-static 
DBGFLAG = 	-g 
GPFLAG  =  	-pg 
WFLAG   =  	-Wall 
CFLAGS  = 	$(DBGFLAG)  $(OPTFLAG) $(STATIC) # $(GPFLAG)$(WFLAG)  

# Executable file 
EFILE   =  	$(CPATH)/test-$(VERSION).out   

# Used libraries 
LIBS =   -lm   

# Header files 
HDRS 	=  	accuracy-$(VERSION).h   \   
		constants-$(VERSION).h   \   
		cross_section-$(VERSION).h  \   
		hadron_current-$(VERSION).h \   
		matrixelement-$(VERSION).h \   
		utils-$(VERSION).h  \   
		wavefunctions-$(VERSION).h \   

# Object files 
OBJS 	=      	testX.o    \   
		cross_section-$(VERSION).o  \   
		hadron_current-$(VERSION).o \   
		matrixelement-$(VERSION).o \   
		utils-$(VERSION).o  \   
		wavefunctions-$(VERSION).o \     

# Targets... 
all:  		$(EFILE) 
clean:     
		@rm -f *.o *~ core  

$(EFILE): 	$(OBJS) $(HDRS) 
		@echo "Linking $(EFILE)..."   
		$(CC) $(CFLAGS) -o $(EFILE) $(OBJS) # $(LIBS)  

$(OBJS): 	$(HDRS) 

# Creation of the object files 

%.o:   		%.cpp    
		@echo "Compiling..."   
		$(CC) $(CFLAGS) -c $*.cpp
 
  


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
problems with opening stdc++ files linuxmandrake Debian 6 10-06-2005 02:15 PM
g++ statically link stdc++ problem berty Programming 1 05-16-2005 06:00 PM
stdc++- failed dependencies. tekmorph Linux - Software 1 08-29-2004 05:21 PM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM
Event driven object-to-object: C++ template class mecanism ( NOT STL or STDC++) bretzeltux Programming 2 12-23-2003 02:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 07: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration