0

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?

Edited by rela

6
Contributors
31
Replies
111
Views
3 Years
Discussion Span
Last Post by NathanOliver
0

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.

Edited by Ancient Dragon

1

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.

Edited by Hiroshe

0

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

0

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.

Edited by rela

0

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.

0

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).

Edited by ITPT

0

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?

0

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

0

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.

0

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 ==========

0

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

0

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

0

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?

0

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

Edited by rela

0

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?

Edited by rela

0

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.

0

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!

0

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

Edited by rela

0

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 ==========

Edited by rela

0

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

Edited by NathanOliver

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.