473,224 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Link error in minGW (seems libstdc++.a is not in the search path)

ddh
Hi,

I download mingw in my system(XP SP2), and extract them in
c:\mingw\gcc, so the directories looks like: c:\mingw\gcc\bin,
c:\mingw\gcc\include ..., and I added c:\mingw\gcc\bin in my PATH env.

It is OK for compiling .c code, but when compiling c++ code, some
error will occur.

my cpp file:

--- tmp.cpp ---
#include <iostream>

int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
And the command line is :
gcc -O2 -o tmp tmp.cpp
It output:

C:\DOCUME~1\user\LOCALS~1\Temp/ccYJbaaa.o(.text+0x1b):tmp.cpp:
undefined refe
rence to `std::cout'
C:\DOCUME~1\user\LOCALS~1\Temp/ccYJbaaa.o(.text+0x29):tmp.cpp:
undefined refe
rence to `std::basic_ostream<char, std::char_traits<char> >&
std::operator<< <st
d::char_traits<char> >(std::basic_ostream<char, std::char_traits<char>
&, char const*)'
C:\DOCUME~1\user\LOCALS~1\Temp/ccYJbaaa.o(.text+0x31):tmp.cpp:
undefined refe
rence to `std::basic_ostream<char, std::char_traits<char> >&
std::endl<char, std
::char_traits<char> >(std::basic_ostream<char, std::char_traits<char>&)'

C:\DOCUME~1\user\LOCALS~1\Temp/ccYJbaaa.o(.text+0x7c):tmp.cpp:
undefined refe
rence to `std::ios_base::Init::Init()'
C:\DOCUME~1\user\LOCALS~1\Temp/ccYJbaaa.o(.text+0x98):tmp.cpp:
undefined refe
rence to `std::ios_base::Init::~Init()'
collect2: ld returned 1 exit status

But if the command line is:
gcc -O2 -o tmp tmp.cpp c:\mingw\gcc\lib\libstdc++.a

Then it will be OK.

So I want to know how to set the envionment so that I can use the
former command line to compile c++ code.

Thank you

Jan 13 '06 #1
2 2704
* ddh:
...


1) Use g++, not gcc, for C++ code.
2) In future, please post to appropriate tool-specific group,
since this group is concerned with the C++ _language_.

Thank you,

- Alf

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jan 13 '06 #2
ddh
Thank you very much. It work.

I am sorry for posting it here.
Alf P. Steinbach wrote:
* ddh:
...


1) Use g++, not gcc, for C++ code.
2) In future, please post to appropriate tool-specific group,
since this group is concerned with the C++ _language_.

Thank you,

- Alf

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


Jan 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: VoiD | last post by:
Aloha! I'm looking for libstdc++ documentation. I've been searching the net for last 2 days! The best thing I can imagine is a downloadable function and class index with at least short...
1
by: Doctor Bones | last post by:
PLease help. I have a decent amount of C++ experience on Windows, but know nothing about Unix. I wrote a simple "Hello World" program on a Solaris box which includes <iostream>. The program...
3
by: Heiko Hund | last post by:
Hi, I do not understand the deeper reason for the following compiler error $ g++ test.cpp test.cpp: In function `int main()': test.cpp:41: error: `std::basic_string<char,...
0
by: David T | last post by:
Has anyone run across this error? When calling any of several visualization routines from FiPy, Python quits with a Bus Error I'm using MacOS X Tiger 10.4.3, and I've tried several builds...
1
by: Plissken.s | last post by:
Hi I have a problem which result in a "corrupted double-linked list error", I would need some help in trouble shot this one: Here is a stack track: Thread (Suspended: Signal 'SIGABRT'...
1
by: Brian Hall | last post by:
I have both mingw and cygwin on a Windows machine. I have installed Eclipse, with the CDT, and written a 'Hello World' test program. I would like Eclipse to use the mingw complier but looking...
3
by: oberon | last post by:
Hi When I try to install the db I get this : # ./db2_install /home/oberon/movie/exp/disk1/db2/linux/install/../bin/db2langdir: /usr/lib/libstdc++.so.5: version `CXXABI_1.2' not found...
1
by: Gary Wessle | last post by:
Hello I am getting this run time error, no clue what to look for. any idea please? many thanks **************************************************************** *** glibc detected ***...
10
by: contactmayankjain | last post by:
Hi, I am getting the following error. Can you tell me any solution to this problem and the reason for this 298 Program received signal SIGBUS, Bus error. 0x000000080137ae02 in...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.