GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Jul-2005, 13:29
aliok.tr aliok.tr is offline
New Member
 
Join Date: Jun 2005
Posts: 22
aliok.tr is on a distinguished road

What's wrong?


Hello guys,

Today I started C++ but it was a bad start.
The code below is compiled in MS VS 6.0, but not build. I study C++ form my book (Deitel&Deitel), everything looks ok but I cant find where is the error. And this is the error message...



CPP / C++ / C Code:
--------------------Configuration: ilk - Win32 Debug--------------------
Linking...
libcpd.lib(locale.obj) : error LNK2001: unresolved external symbol "public: virtual void * __thiscall std::runtime_error::`scalar deleting destructor'(unsigned int) throw(long, ?? )" (??_Gruntime_error@std@@UAEPAXI@J)
Debug/ilk.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

ilk.exe - 2 error(s), 0 warning(s)





CPP / C++ / C Code:
#include <iostream>



int main()
{
	
	int integer1;

	std::cout << "integer 1 :\n";
	std::cin >> integer1;

	int integer2,sum;

	std::cout << "integer 2 :\n";
	std::cin >> integer2;
	sum=integer1+integer2;

	std::cout << "Sum=" << sum << std::endl;


	return 0;
}
  #2  
Old 03-Jul-2005, 13:48
Jeremiah Jeremiah is offline
New Member
 
Join Date: Jul 2005
Posts: 11
Jeremiah is on a distinguished road
you forgot the .h in #include <iostream>. Some compilers can be a bit picky, but I compiled this in Dev C++ and it worked perfectly fine. Or atleast it compiled, in other words.

Looks like you have a compiler issue on your hands. A couple of libraries or objects referenced in the wrong way? Misconfiguration as far as I know from the output. Try reinstalling.
  #3  
Old 03-Jul-2005, 13:56
aliok.tr aliok.tr is offline
New Member
 
Join Date: Jun 2005
Posts: 22
aliok.tr is on a distinguished road
Quote:
Originally Posted by Jeremiah
you forgot the .h in #include <iostream>. Some compilers can be a bit picky, but I compiled this in Dev C++ and it worked perfectly fine. Or atleast it compiled, in other words.

Looks like you have a compiler issue on your hands. A couple of libraries or objects referenced in the wrong way? Misconfiguration as far as I know from the output. Try reinstalling.

I dont think it is about iostream... When I change iostream to iostream.h this is happened::



CPP / C++ / C Code:
--------------------Configuration: ilk - Win32 Debug--------------------
Compiling...
ilk.cpp
c:\documents and settings\ali\desktop\c++\c++\ilk.cpp(10) : error C2653: 'std' : is not a class or namespace name
c:\documents and settings\ali\desktop\c++\c++\ilk.cpp(11) : error C2653: 'std' : is not a class or namespace name
c:\documents and settings\ali\desktop\c++\c++\ilk.cpp(15) : error C2653: 'std' : is not a class or namespace name
c:\documents and settings\ali\desktop\c++\c++\ilk.cpp(16) : error C2653: 'std' : is not a class or namespace name
c:\documents and settings\ali\desktop\c++\c++\ilk.cpp(19) : error C2653: 'std' : is not a class or namespace name
c:\documents and settings\ali\desktop\c++\c++\ilk.cpp(19) : error C2653: 'std' : is not a class or namespace name
Error executing cl.exe.

ilk.exe - 6 error(s), 0 warning(s)
  #4  
Old 03-Jul-2005, 14:07
blank blank is offline
Junior Member
 
Join Date: May 2005
Posts: 39
blank is on a distinguished road
When I program, I like to program so that it's the easiest and neatest way possible, to avoid any syntax errors.

CPP / C++ / C Code:
#include <iostream>     //sometimes compiler wants .h, but vs doesn't

using namespace std;   //add this line so that you dont have to type std::

int main()
{
  
  int integer1, integer2, sum;

  // just use endl instead of \n

  cout << "integer 1 :" << endl;
  cin >> integer1;

  cout << "integer 2 :" << endl;
  cin >> integer2;

  sum = integer1 + integer2;

  cout << "Sum = " << sum << endl;


  return 0;
}

I'm not able to test this at this moment, but try it now.
  #5  
Old 03-Jul-2005, 14:18
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough
Aliok, it has to be a problem with your MSV. It compiles and executes fine for me on W2K cygwin g++.

Jeremiah, do some searches here and find out about the <iostream> vs. <iostream.h>

You are suggesting to use old syntax. Dropping the .h is the correct thing to do. Leaving it there is deprecated or antiquated. Including without the .h allows inclusion into the std namespace. There is a lot of good info both here and that going a-googling will get you.

My output (with the .h)
Code:
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iostream.h:31, from aliok_prob.cpp:1: /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #6  
Old 03-Jul-2005, 14:20
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,218
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by aliok.tr
Hello guys,

Today I started C++ but it was a bad start.
The code below is compiled in MS VS 6.0, but not build. I study C++ form my book (Deitel&Deitel), everything looks ok but I cant find where is the error. And this is the error message...


There is nothing wrong with your original C++ code. It will compile and execute perfectly with Visual C++.

If you are using the Integrated Development Environment, how do you have your project set up? Should be a "Win32 Console Application". If you are using command line compiler (cl.exe) are the environment variables set properly for Visual C++?

Make sure your source file has .cpp extension. (Like main.cpp or test.cpp or something like that.)

Regards,

Dave

[edit]
Is this a new installation of VS 6? How did you install it? Any interesting events during the installation (error/warning messages, etc.) Have you successfully created any C programs or any other C++ programs with this installation?
[/edit]
Last edited by davekw7x : 03-Jul-2005 at 15:42.
  #7  
Old 03-Jul-2005, 15:39
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,335
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by Jeremiah
you forgot the .h in #include <iostream>. Some compilers can be a bit picky, but I compiled this in Dev C++ and it worked perfectly fine. Or atleast it compiled, in other words.
Actually, the .h should not be used with C++ headers. That is an older style and has been replaced by the extensionless headers. You should probably switch the the current standard.
__________________

During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence?
  #8  
Old 04-Jul-2005, 10:27
aliok.tr aliok.tr is offline
New Member
 
Join Date: Jun 2005
Posts: 22
aliok.tr is on a distinguished road

re:


Thanx everyone.. I think the problem is my VS6. Devcpp compiles and builds it perfectly

I think VS2003 .NET changed configuration of VS6.

By the way, is there anyone uses VS2003 .NET??? I cant find how to compile with it.

Rookie
  #9  
Old 04-Jul-2005, 11:39
Sokar Sokar is offline
Member
 
Join Date: May 2005
Posts: 243
Sokar has a spectacular aura aboutSokar has a spectacular aura about
Quote:
Originally Posted by aliok.tr
By the way, is there anyone uses VS2003 .NET???
Yes.

Quote:
Originally Posted by aliok.tr
I cant find how to compile with it.

Rookie
Find the build button/drop down menu at the top, then click and find "build solution" or "rebuild solution". Then to run the program from within the IDE goto debug and click start without debugging.
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with if statement (was: what is wrong???) rubenryhan C Programming Language 2 02-May-2005 09:09
Functions and Classes - Where did I go wrong? redmage C++ Forum 5 10-Apr-2005 19:31
Something's wrong w/my program. agentxx04 C Programming Language 1 07-Nov-2004 11:03
where am i going wrong? nkhambal C Programming Language 5 03-Aug-2004 08:36
something wrong with this code loon MySQL / PHP Forum 5 07-Jul-2003 06:55

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:24.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.