I am a beginner, and want to know how can run the code in notepad with visual studio. I tried with a simple code by --<<All Program -->microsoft Visual --> visual Studio tools --> visual Studio command prompmt.
The error is: ''fatal error C1083: cannot open source file: filename.cpp: No such file or director''
Can you help me?

Are you trying to wite a program with Notepad then compile it with VS iDE? The easiest was is not to use Notepad, but to do all your work is VS iDE. Here are a few articles to get you strted.

I'm not sure why you would be using notepad. The IDE as Ancient Dragon mentioned would be the easiest.

If you wanted to use your own text editor, one option would be to make a project in VS, and use VS to manage the files as well as the compiltion, and use your own text editor as an accessory. Visual Studio also has a built in feature to allow external editors.

You could also compile your code from the command line user the VS compiler. Just add the VS compiler you wish to use (there are different compilers for different platofrms) to the path, and use vcvars32 to set up the environment, and use CL to compile your program. You can also use MSBuild and nmake.

I agree with @Hiroshe
Visual Studio is a best enviroment for learning
use of its facilities
for ex:
VS->file -> new -> project ->Win32 Console Application (enter name of your Project) -> (welcom windows) next -> (application setting) select Empty Project and click on finish button...
in your project:
solution explorer -> source file ->right click-> add -> new ...
and enjoy

Thanks for your information.
I try the visual environemnt when I am writing the new code, but I want to open one existing code, it includes some notepad files containing .cpp and .h, and I dont know how I can open and run it!
I saved it in the same directory that I debug the new codes, but when I use "file >> open >> project,solution" to open it, the file is empty, and it doesnt show those files.

If the files were not part of a previous project then you need to create a new blank project and then add the files to it.

you can creat an empty project and then :
solution explorer -> source file ->right click-> add -> existing Item (this is for .cpp file)
solution explorer -> Header file ->right click-> add -> existing Item (this is for .h files)

and you must include your headerfile in your .cpp file but no with <> you must use "" (qoutation).

Thanks! I did this procedure, ... -> existing Item (this is for .cpp file)
... -> existing Item (this is for .h files)
and should I have this finally?

357b66fe441774d9f25553bc1ab321d7

This post has no text-based content.

Yes. Now you need to compile it.

When I debug, it shows this error:
"There were build errors. Would you like to continue and run the last successful build?"

Most likely your code is wrong in one or more places and needs to be fixed. You can expand the Errors tab or the Output tab to view errors and warnings during build.

Just these are the last lines of output tab:
1> Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.89
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

If you go to [ view -> error list ] is there anything in the error list?

similar lines including "error C1083: Cannot open include file: 'lh_dllnex.h': No such file or directory.

Are you using a third party library? If so you need to tell visual studio where those header files are. You can do that going to [ Project -> Properties -> C/C++ -> General -> Additional Include Directories ].

7d01513d51bacda2fd1dcff839c04a84

It is in Libraries/Documents/Visual studio/ Projects/ Newproject1
Shoul I write this until where? There is another option that I can select the directory from it, but which file I should select?

e5a9b63b5f780a5191f022fbbbf91eb0

This post has no text-based content.

Navigate to the folder where the header file is located and then pick "select folder".

I created the "newproject2" again and it includes these files:

!

18270696a0af563d85e0d4e7502e711f5c34b25ad38bddb36468ba70e788517b

This post has no text-based content.

I saved the header and .cpp files in the second "newproject2" (second figure in the left side!) that are shown in the third figure, is it correct? and in selecting directory I should select the second "newproject2" again?

You need to set the included directory in your project to wherever "lh_dllnex.h" is located. That header file appears to be from a third party library so you need to make sure you have the library and that it is being included in your projects include directory.

Now erros are for .cpp files "fatal error C1083: Cannot open source file: '..\O_PV.CPP': No such file or directory
1> O_PSIMP.CPP" but all .h and .cpp files are included in the project file!

Is o_psimp.cpp trying to included o_pv.cpp?

Do you mean in "O_PSIMP.CPP" shoud have "#include "O_PV.CPP"" ?

I am asking does O_PSIMP.cpp have #include "O_PV.cpp" in it. If not copy and paste the exact error output here.

No, it's not included, This is the error:
1>------ Build started: Project: newproject2, Configuration: Debug Win32 ------
1>Build started 7/17/2014 5:05:52 PM.
1>InitializeBuildStatus:
1> Touching "Debug\newproject2.unsuccessfulbuild".
1>ClCompile:
1> o_bsimp.cpp
1>c1xx : fatal error C1083: Cannot open source file: '..\o_bsimp.cpp': No such file or directory
1> O_USYS.CPP
1>c1xx : fatal error C1083: Cannot open source file: '..\O_USYS.CPP': No such file or directory
1> O_PSIMP.CPP
1>c1xx : fatal error C1083: Cannot open source file: '..\O_PSIMP.CPP': No such file or directory
1> Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.21
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Can you post a screen shot of the contents of newproject2 directory in detail view?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.