🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42097

Seg violation when programs make with "ld" explicitly

#42097
From: TK
Date: Tue, 23 Jan 1996 00:00
31 lines
999 bytes
Does anyone know why when I make a program by compiling with "-c" flag and
then doing a "ld" explicitly causes the program to core dump with
a segmentation violation when the main program ends?  This only happens
when doing OO stuff.

This does not happen when I compile and load using gcc without the "-c"
flag.

My environment is Solaris2.4 using gcc 2.7.2.

Thanks in advance.
Terry Kendall.

Example prog:
-----------------------------------------
main()
{
	CTest new();
}

class CTest
{
public:
	CTest();
}

CTest::CTest()
{
	cout<<"Made it\n";
}
------------------------------------------
Technical Details
Message-ID: <4e2ti0$6mf@natasha.rmii.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,cd2a2ed6241ed12f,start
X-Google-Attributes: gid11318c,public
From: TK@xyz.abc.com (TK)
Subject: Seg violation when programs make with "ld" explicitly
Date: 1996/01/23
Message-ID: <4e2ti0$6mf@natasha.rmii.com>
X-Deja-AN: 136066394
organization: Rocky Mountain Internet Inc.
newsgroups: gnu.gcc.help