fatel error c1083

Hi i am new to coding and microsoft visual c++ express. Anyway i already have set it all up right even used the videos to do which you can find here:

http://msdn.microsoft.com/visualc/learning/vcexpvids/default.aspx

Anyway i am using a c++ a beginner's guide se by herbert schildt i have been trying to compile the fist simple program code in chapter one here is the code exactly as the book states.

/*
This is a simple C++ program.

Call this file Sample.CPP.
*/

#include <iostream>
using namespace std;

// A C++ program begins at the main().
int main()
{
cout << "C++ is a power programming.";

return 0;
}

I know when i use the command it gives me in bood int he command prompt here is the command.

C:\...>cl -GX Sample.cpp Well i typed the cl -GX Sample.cpp and i guess -GX is nolonger beign used, but at least it tells me what to use /EHsc or -EHsc.

My problem is this i get this error:


I saved the document it goes to my projects folder in documents. I started it out by goign to new file and choosing source.cpp file and saved it as Sample. The file is there so i am not understanding why am i gettign this. Last night when i was trying i used the example in the book in how to in command section on complie a program and i get a link error or this error weird can some one help me please i want to get through chapter one lol.



Answer this question

fatel error c1083

  • Golden Strands

    Ok the IDE can compile files, but you need to create a solution. If you create the solution and then add the files to the solution then it will compile.

    For the command line though, the very first thing you did was to add everything to the environment variables. So it will be able to find all of the executables, header files and library files from anywhere on your system.

    So this means that if you are in the directory where your source files are then you will be able to run cl.exe just by typing the file name. This is handy because when you want to compile source files you have to tell the compiler where the files are, so instead of typing cl.exe c:\temp\somepath\source.cpp, if you change your current directory to c:\temp\somepath\ then you can just type cl.exe source.cpp and it will compile your file.

    I hope this helps, and if you need any more help then just ask.



  • Joe Morin

     CourtJesterG wrote:
    Well i don't get it! I mean it sets it all up iot self i  chose the  deafault  setup for visual c++ express 2005. I also saved  my projects and or  files  int he default  location yes. I also  use the command line so  how  coem it isn't  finding  my file

     [ ... ]


          How coem  it seems nobody  else has this problem I feel so alone.

    [ ... ]

    Yeah thanks for the  reply! Your reply is  quiet elabrote and  somewhat confusing. Should i unistall  visual and reintall it to just c:/ would this  help me out I tryed  installing to my other harddrive but  it said it can't needs to be onthe main.

     [ ... ]


                  I just want to  compile  programs  not run a server!

    Thanks for the additional details.  Some quick responses:

    1. You do not need to reinstall anything.  Your installation is probably fine.

    2. People who try to do command-line compiles do have the problem that you do.  If they are experienced (and that is why they use command line), they know how to make it work.  Others usually use the IDE for compiling, not the command line.  This makes it easier to execute and to find everything else when you learn to look for it.

    3. If you want to be using the command line, because that is what many books on C/C++ assume, etc., you will need to learn to where to put things, and how to be in the same folder as your source program when you compile.

    I don't know how not to deep-end beyond this point.  There may be other advice that works, but we need your help.  Please provide this information:

    a.  Your level of experience with C/C++ - are you a beginner, have you used C/C++ with other compilers, operating systems, what   Do you have command-line experience already or do you need to learn how to operate in that mode, navigate around your system, find things, set environment variables, and so on   (Whether you understand this question is enough to know the answer.)

    b. What you want to do   Do you want to make Windows GUI applications, just learn a programming language, do C/C++ self-study from a book, what   Are you familiar with the Windows GUI and how to move around among folders, find materials, create folders, copy, move, and delete files, make shortcuts (links), etc

    c. What resources do you have   Do you know others that can be your buddy and guide you through parts of this   Do you have books and internet materials    Are you willing to obtain beginner materials and work through them if that is what you need

    Without knowing more about your situation, it is very difficult to provide tips and suggestions that will be useful.  If you are a raw beginner, that's fine, but without knowing that it feels stupid to give you advice that (1) assumes you are and that you don't need or (2) assumes you are more advanced and is useless to you until you know the basics.

    Without more context from you, it is very difficult to provide useful responses.



  • Kevin Moore

    CourtJesterG wrote:

    You keep saying IDE for compileing i thought actually the command promt was the only way in 2005 express. The help for compileing only states the command prompt and even takes you in a walk through with it, but i still get that same error witht he walk through lol. Any help would be good thanks.

    Part of the problem is understanding how to do the setup for command-line compiling so that you compile in the same place your source code has been stored. There are ways to smooth that out, but it takes a bit of experience with how the compiler works.

    Meanwhile, here is a little more about using the IDE to make a project and get code to work. I'm refering to these because I have postings there that might help you. There may be other, better sources here too, but I'm not sure how to find them . I know where these are. Even if these make no sense, they will at least take you through the motions for using the IDE to build, debug, and execute your code.

    Start with the IDE. It makes editing your code and checking for errors much simpler.

    Here are links about compiling programs with the IDE:

    Later you can learn where VC++ puts the files you create and puts the compiled programs. After that you can learn to use them outside of the IDE. You can also learn to use the command-line compiler or the VC++ IDE on the same projects.



  • hans04

    Yes i am a beginner, i have no previous knowledge nor experice tryign to us a compile beside the 2005 express one i been tryign t use. I am self study a book i am using c++ a beginners guild sec edition by herbert schildt.

    I want to learn from this book then further my knowledge even more and buy another more expert book. I then want to use this knowledge to make programs in a win enviroment and to help in the mod development community even make my own mod.

    You keep saying IDE for compileing i thought actually the command promt was the only way in 2005 express. The help for compileing only states the command prompt and even takes you in a walk through with it, but i still get that same error witht he walk through lol. Any help would be good thanks.


  • EricA_MS

    Well i don't get it! I mean it sets it all up iot self i chose the deafault setup for visual c++ express 2005. I also saved my projects and or files int he default location yes. I also use the command line so how coem it isn't finding my file

    I have tryed this lots of whys instead of making jsut a file i did new project and did it from existing source code complier still gives me the same thing. I even did the help section example in command complieing a naive program. I get the same error can't file file.

    How coem it seems nobody else has this problem I feel so alone.

    Yeah thanks for the reply! Your reply is quiet elabrote and somewhat confusing. Should i unistall visual and reintall it to just c:/ would this help me out I tryed installing to my other harddrive but it said it can't needs to be onthe main.

    Also should i install the optional software example the rest of the msdn or something like that and the sql sever

    I just want to compile programs not run a server!


  • GarthK

    If you are going to use the compiler from the command line, you need to change to the directory that has the Sample.cpp file.

    You should not be doing your compiles in C:\Program Files\... which is normally to be used only for read-only materials that are accessible by any user on the machine, and should usually not be used for work space. (Yes, I know this is where the VC++ Tools | Visual Studio 2005 Command Prompt menu selection puts you, but it is not where you should actually be doing compiles.)

    The easiest way to do this is to use the VC++ IDE. Then it will put your projects and new files in the right place and also use all of the appropriate compiler options.

    The other way is to make a command-prompt shortcut that will put you where your project files are (typically in "C:\Documents and Settings\user\My Documents\Visual Studio 2005\Projects"). Bring a copy of vcvars32.bat here to make it easy to find, and run it as part of starting the command prompt. Create subdirectories for your projects and put the source code inside the subdirectory. Switch into the subdirectory before you compile. (If you do this, the same folder can be used as a VC++ IDE Project and as a command-line compiler project, although there are important differences between the two in terms of where the compile is done and the resulting .exe is placed.)

    This is a bit elaborate to spell out in a forum post. I do this everytime I install the VC++ Express Edition and I must give priority to putting up an example. It nags at me that the built-in Command Prompt (and the one in your Start | All Programs | Visual C++ ... ) put you in an undesirable place when the default project location is elsewhere.



  • fatel error c1083