Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] GCC compiler error for C++ program

Status
Not open for further replies.

vead

Full Member level 5
Full Member level 5
Joined
Nov 27, 2011
Messages
285
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
india
Activity points
3,815
Hello
I was trying to compile basic c++ program on GCC compiler but when I compile program. Compiler show some error
Program code
Code:
#include <iostream>
using namespace std;

int main(void) 
{
    cout << "Hello, World!";
    return 0;
}
Error

C:\Users\Mr Embedded\Desktop>gcc -o exm exm.cpp
C:\Users\MREMBE~1\AppData\Local\Temp\ccYk0frH.o:exm.cpp:(.text+0x19): undefined reference to `std::cout'
C:\Users\MREMBE~1\AppData\Local\Temp\ccYk0frH.o:exm.cpp:(.text+0x1e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::eek:perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
C:\Users\MREMBE~1\AppData\Local\Temp\ccYk0frH.o:exm.cpp:(.text+0x35): undefined reference to `std::ios_base::Init::~Init()'
C:\Users\MREMBE~1\AppData\Local\Temp\ccYk0frH.o:exm.cpp:(.text+0x56): undefined reference to `std::ios_base::Init::Init()'
collect2.exe: error: ld returned 1 exit status

What's the reason ? How to solve problem ?
 

include -lstdc++ in your command and check whether 'lib' folder is installed.
 

Hey pancho_hideboo thanks, This command g++ -o exm exm.cpp is working. Thank's sirzbf
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top