LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (https://www.linuxquestions.org/questions/mandriva-30/)
-   -   g++ library problem stdc++ (https://www.linuxquestions.org/questions/mandriva-30/g-library-problem-stdc-175530/)

kvtournh 04-28-2004 10:36 AM

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



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