Jump to content
  • Advertisement
Sign in to follow this  
ProgrammingNerd

[.net] problems building a console app

This topic is 4847 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just set up vc2005 on my computer. I was trying to compile a console app using iostream.h and it couldn't find the file. So, I added it's directory to the list. Now it needs a library(msvcirtd.lib). So I search for it. It finds it in two folders(AMD64 and IA64). These look like 64 bit libraries. But I am running a 32 bit computer. So, where am I going wrong. Thanks for any help, ProgrammingNerd

Share this post


Link to post
Share on other sites
Advertisement
Now, it won't compile. So I build a test app to investgate this:


// SMF Creator.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream"


int _tmain(int argc, _TCHAR* argv[])
{
char ch;

cout << "Welcome to the SMF Mesh Creator V1.0" << endl;
cout << "By Chad Seibert" << endl;

cin >> ch;

return 0;
}



Here are the errors:

------ Build started: Project: SMF Creator, Configuration: Debug Win32 ------
Compiling...
SMF Creator.cpp
c:\smf creator\smf creator\smf creator.cpp(12) : error C2065: 'cout' : undeclared identifier
c:\smf creator\smf creator\smf creator.cpp(12) : error C2065: 'endl' : undeclared identifier
c:\smf creator\smf creator\smf creator.cpp(15) : error C2065: 'cin' : undeclared identifier
Build log was saved at "file://c:\SMF Creator\SMF Creator\Debug\BuildLog.htm"
SMF Creator - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



Thanks for any help,
ProgrammingNerd

Share this post


Link to post
Share on other sites
cout, cin and endl all live in the std namespace. You either need to put a using declaration or directive or prefix each of them with std::. Ex: std::cout, std::cin, std::endl or

using namespace std;

Share this post


Link to post
Share on other sites
you should be using angle brackets around the header name for iostream (you must have copied it to the project directory if it's working now), not quotations marks. Quotation marks tell the preprocessor to look for the file relative to the current location. Angle brackets tell the preprocessor to look for the file relative to the header directory of the compiler. stdafx.h is in the same directory as the project, so you use quotes. iostream is in the header directory for the compiler, so you use angle brackets

#include "stdafx.h"
#include <iostream>

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!