Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

[gcc] error init does not name a type[solved]

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
5 posts • Page 1 of 1
Author
Message
kevstar31
Guru
Guru
User avatar
Posts: 449
Joined: Wed Nov 22, 2006 6:03 pm
Location: Ohio

[gcc] error init does not name a type[solved]

  • Quote

Post by kevstar31 » Sat Jan 10, 2009 6:47 pm

I am trying to compile a C++ program using the exact source code. But gcc will not let me. i just get error init does not name a type. A nice first look a C++

Code: Select all

// a small C++ program
#include <iostream>

init main()
{
	std::cout << "Hello, world!" << std::endl;
	return 0;
}
Last edited by kevstar31 on Sat Jan 10, 2009 6:53 pm, edited 1 time in total.
while(true) std::cout << "Jesus I trust in you." << std::endl;
My Political Compass
Top
codergeek42
Bodhisattva
Bodhisattva
Posts: 5142
Joined: Mon Apr 05, 2004 4:44 am
Location: Anaheim, CA (USA)
Contact:
Contact codergeek42
Website

  • Quote

Post by codergeek42 » Sat Jan 10, 2009 6:49 pm

Should be "int" (short for "integer"). :)
~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF
Top
widremann
Veteran
Veteran
Posts: 1314
Joined: Mon Mar 14, 2005 9:47 pm

  • Quote

Post by widremann » Sat Jan 10, 2009 6:52 pm

codergeek42 wrote:Should be "int" (short for "integer"). :)
The correct way to fix this code is:

Code: Select all

// a small C++ program
#include <iostream>

#define init int

init main()
{
   std::cout << "Hello, world!" << std::endl;
   return 0;
}
Top
kevstar31
Guru
Guru
User avatar
Posts: 449
Joined: Wed Nov 22, 2006 6:03 pm
Location: Ohio

  • Quote

Post by kevstar31 » Sat Jan 10, 2009 6:57 pm

:lol: :lol:
Thanks,
Kevin
while(true) std::cout << "Jesus I trust in you." << std::endl;
My Political Compass
Top
bunder
Bodhisattva
Bodhisattva
Posts: 5956
Joined: Sat Apr 10, 2004 5:13 am

  • Quote

Post by bunder » Sat Jan 10, 2009 8:59 pm

Moved from Off the Wall to Portage & Programming.
Neddyseagoon wrote:The problem with leaving is that you can only do it once and it reduces your influence.
banned from #gentoo since sept 2017
Top
Post Reply

5 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic