[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] g++ og gdb segmentations fejl



James wrote:
Følgende giver segmentationsfejl

#include <string>

int main(int argc, char *argv[]) {
std::string server="Dette";
return 0;
}

Jeg har brugt

gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)


Er der nogen der har en forklaring?



Jeg er klar over, at gcc også kan bringes til at oversætte og linke C++ programmer, men personligt anvender jeg altid g++, som kalder "GCC with the default language set to C++, and automatically specifies linking against the C++ library."
(se http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc.pdf)


På min CygWin, som har samme gcc og gdb som du, kan jeg oversætte og linke, og efterfølgende afvikle programmet med gdb:
------------------------
tmp> !ca
cat segment.cpp
#include <string>


int main(int argc, char *argv[]) {
std::string server="Dette";
return 0;
}
tmp> !g+
g++ segment.cpp
tmp> !gd
gdb a.exe
GNU gdb 6.3.50_2004-12-28-cvs (cygwin-special)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...(no debugging symbols found)


(gdb) r
Starting program: /tmp/a.exe

Program exited normally.
(gdb) q
------------------------

Jeg kan med andre ord (med g++) ikke genskabe dit problem.

mvh
Jan


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-06-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *