Visual Studio - "The system cannot find the file specified" - visual-studio

I just installed Visual Studio Community 2017 for school purposes. My lecturer gave us these instructions to use a GraphicsSDK library with VS (after we have Visual Studio installed). I ran the Tutorial.sln file he gave but I got this error.
I have followed all the steps correctly. I've been looking at other questions on StackOverflow and they said to change the Properties/Output file to $(OutDir)$(TargetName)$(TargetExt) but mine is correct.
I also noticed one line in the code which was underlined red.
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
It said that GL_COLOR_BUFFER_BIT was undefined. Not sure if this matters at all.

In older versions of Visual Studio the folder settings were part of the IDE. But in version 2017 you specify the search paths in the application itself.
If you go to your projects properties you will see a VC++ Directories section:
You need to make sure that the folders to the libraries and include files are correct (for both debug and release configurations).
Then, when you do a build it will be able to find the definitions it needs. But your question is lacking a lot of information. This is my educated solution for now.

Related

rt_matrx.c(29): fatal error C1083: Unable to open include file: 'stdlib.h' : No such file or directory

I have an issue during the compilation of a Simulink model, the model worked since I had a change in my Windows professional account, now I can't compile it anymore, and the following error is appearing in the debug window of Simulink:
rt_matrx.c(29): fatal error C1083: Unable to open include file: 'stdlib.h' : No such file or directory
I saw a similar issue on the Mathworks forum, which was resolved by reinstalling MATLAB, I tried to do the same and it didn't work for me.
I checked if the environment variables on my new windows account are the same from the previous one, they didn't change.
I don't have admin rights so I asked to my IT service if I was able to access all the paths I use with MATLAB, and apparently it's not the problem here.
My theory is that there is maybe an issue with how MATLAB and Visual Studio are linked together, that or maybe it comes from how the path is defined.
I'm a little lost for this issue, I would be glad if someone could help me or at least guide me on the origin of my problem, thanks you in advance.
MATLAB version: 2020A
Compiler version: Visual Studio 2019
Hello everyone, for the people in need i found the solution of my problem, it came from two points :
The environment of Visual studio 2019 :
I use Visual Studio 2019 community to compile my projects on MATLAB and SIMULINK, and if you have MSVC and the SDK kits installed at the same time i can create conflicts within your compilation (You can find this specifics add-ons on Visual studio installer > Visual studio 2019 Community > modify > C++ Desktop development).
Be sure when you install VS2019 to only get the strict minimum of add-ons you need to do your project.
My access rights to the MATLAB and Visual studio folders :
Check if you have a total control of your project (Right click on the folder concerned > Properties > Security, choose your user profile and check your rights).
For my part it worked when i changed my access rights of C:\Program Files\MATLAB\R2020a (be sure you have time for that because it took one hour for me, maybe you can only change the right to "toolbox" and it could works but i'm not sure about that) and C:\ProgramData\Speedgoat\speedgoatlib\R2020a
If the last solution doesnt work check the access rights of the other folders that are concerned by Matlab and visual studio.

Visual Studio 2019 Preview 1 missing windows.h

I am attempting to compile a .cpp file on Visual Studio 2019 Preview 1 and the file windows.h is not present on the system. What do I have to do to make this file available to Visual Studio? The file being compiled contains include <windows.h>.
windows.h usually comes from Windows SDK installation. Like you discovered, some projects might even require a certain version of Windows SDK. Therefore, when such compilation errors happen, the first thing to do is to read carefully the source code documentation, which might indicate what is needed to install in advance.
Visual Studio 2017/2019 become more modular than previous releases, so missing a component is expected, and you can always go back to VS installer to find the suitable components to install.

Visual Studio 2010 , QT and intellisense/highlight error

Hi have a problem with VisualStudio 2010 and the QT5 plugin, it seems that VisualStudio doesnt recognize the QT Library (despite i have installed the plugin and followed the whole procedure).
This is what I see:
https://www.dropbox.com/s/yyzvfev0zoj8x9n/visualstrudel.jpg
So the IDE highlights the QT stuff like if the files were not present, and Intellisense is not working. But, If I compile the application, it compiles without error and works like a charm.
What could be the cause of the highlight/Intellisense issue?
You cannot launch Visual Studio 2010 directly.
You will need to launch the QT 5.0.1 for Desktop(MSVC 2010) command line from Program Files->Qt 5.0.1->5.0.1
After which you will need to run the vcvarsall.bat and devenv after.
x:\program files(x86)\Microsoft Visual Studio 10.0.\VC\vcvarsall.bat
x:\program files(x86)\Microsoft Visual Studio 10.0.\Common7\IDE\devenv.exe
This is applicable to VS2012 and Qt4.5.0, though I believe Qt version does not matter.
I am not sure if it is the same/similar to VS2010, but I stumbled upon this post while looking the answer to the same question for VS2012.
Here is what you can do:
Right-click the project in your solution and select Properties.
Select Configuration Properties -> VC++ Directories.
Edit Include Directories entry.
Add $(QTDIR)\include\QtCore and any other (required by your project) Qt folders to the list (it depends what Qt headers you are using).
This has to be done to every project in your solution that uses Qt, unfortunately.
Now, there is another note:
We were transferring our solution from VS2005 to VS2012 and that problem happened to me when I converted the solution 2005->2012 BEFORE setting the QTDIR environment variable.
When I re-converted the solution again (AFTER *QTDIR* variable was created) the problem didn't appear. So make sure you have this variable before you open/convert your solution for the first time.
Based on the previous note, I believe that some information related to the issue is stored in one of the following files: .sdf and/or .v11.suo.
So closing VS, deleting these files and opening VS again might help. Just back them up before you do it - I haven't tried it myself (I just re-imported the whole solution which generated these files anew).

OpenCV & Microsoft Visual Studio 2012 ( for x64 )

I have been trying to run OpenCV through MVS 2012 with no succeess.
Here is an error i get:
1>LINK : fatal error LNK1104: cannot open file 'opencv_core242d.lib' 1> 1>Build FAILED.
Could someone provide me a tutorial? or how can i solve this problem?
I've written a blog post on Using OpenCV 2.4.2 with Visual Studio 2012 on Windows 7 (64-bit). With the step by step instructions provided, I think it should be pretty easy for you to get it done. Feel free to comment if you have any doubts.
Since OpenCV 2.4 does not work well with Visual Studio 2012. I think that's why you always got problems. Actually, it used me a lot of time to make all things work. So I wrote a very simple tutorial about how to use OpenCV 2.43 in Visual Studio 2012. Please check it. Good luck. If you still have questions, ask me again.
http://answers.opencv.org/question/6495/visual-studio-2012-and-rtlfreeheap-error/#6603
Some basic steps...
use cmake to create the .sln or the solution file ...make sure you choose right the compiler in cmake properly...use the address of the cmake file (CMakelist.txt) in the folder containing opencv files..
click on the .sln file (this will be found in the target folder whose path you have set in cmake to contain the build..) and open with VS2012
VS2012 will build your libraries and dlls...add the path of the dlls to the system variable PATH...put the path of the libs in the IDE..and the include files also..
restart VS2012 to make the changes in PATH variable to reflect
You have 2 options - one is to use the precompiled libraries and link them into your VS2012 projects.
The other is to use CMake to make the the right .SLN and .PRJX files so you can simply open them .SLN in VS2012 and compile everything for yourself.
Both have been discussed here, however, to add to the first option, you need to manually edit the top level CMAKElist.txt file with the following lines
if( MSVC ) # VS2012 doesn't support correctly the tuples yet
add_definitions( /D _VARIADIC_MAX=10 )
endif()
Before generating your solution files. This ensures that you don't have problems with the VARIADIC length issue with :tuple - which Visual studio 2012 has issues with.
there may be 2 option to solve your error:
1) You may use opencv 2.4.2 that may have some problems to connect with visual studio 2012
so use newer version of opencv
2) You need to restart your visual studio 2012 so that it can reconfigure its Setting as per requirements.

Visual Studio compiles but the exe isn't there

Source code that compiles fine on other peoples environments won't correctly work in my environment. When I do a rebuild the compile occurs but when visual studio goes to move the exe from /obj/debug/{solution} to /debug/{solution} it cannot find the exe in the /obj/debug/{solution}. To make this even more crazy even after I reinstall visual studio it doesn't work. On other people environments it works find. Please note that this is a windows mobile 6, compact framework 3.5 project, Visual C++ project.
EDIT: Visual Studio 2008 is being used.
EDIT2: After looking at the logs again come to find out it says it is compiling but it isn't really compiling. Interesting enough it doesn't throw any errors until it tries to link the code. When it goes to link the object files, they aren't there and it fails.
I got TWO Release folders: one in the solution folder and one in the project folder. The former contains the .exe file, the latter does not.
In the solution properties page, check whether the path you are expecting the exe to be is same as the one specified in Linker -> Output file.
Another obvious mistake could be, check what build configuration you are building. You might be doing a release build and expecting a debug executable file :) I have done this a few times.
Maybe VS creates the exe, and before it tries to move it to the final destination your virus scanner grabs it and removes it, or moves it to a save location.
I just wanted to chime in and ask: have you looked for the *.exe file name from the directories above? What I found in my case was it was writing to the directory right above the /release subdirectory. Not sure how I missed that detail, but I did! I suppose it never occurred to me earlier because I saw the buildlog.htm being written to the /release subdirectory, and the very existence of the directory itself. In my case it was compiling, linking, etc. I just wasn't able to see the *.exe in that /release subdirectory.
There are two subtly different paths. I was looking here, which doesn't exist:
C:\Users\james\source\repos\CppHelloWorld\Release\CppHelloWorld.exe
The actual exe is here - note the path contains the x64 platform that it was built for:
C:\Users\james\source\repos\CppHelloWorld\x64\Release\CppHelloWorld.exe
In general, the path seems to be:
$PROJECT_PATH\$PROJECT_NAME\$PLATFORM\$CONFIGURATION\$PROJECT_NAME.exe
If the exact same solution works on other machines, then it's an environment problem and no amount of looking at the project, linker, etc is going to resolve this. What is different about the environments? Are the same service packs and QFE's applied for not just Studio, but also the OS? Is there a difference in processors (64/32-bit)? Are your permissions the same? Do you have the same SDKs installed?
I'd agree with Shahi that just trying to build a "hello world" app against the same SDK and see if it will compile is valuable info.
I had exactly the same problem. Just close Visual Studio and reopen it again (basically restart it) and it should work.
In my case, my network security team released an unannounced security update that preventing me from creating any .exe files. I figured that out at midday after trying all the solutions (+ more) here.
Perhaps you do not have write permission to the output folder? If you are running on Vista/7, is your Visual Studio running as elevated?
I've found this to be random for myself in now VS2016. My work around has been to just create another project and copy the contents from the one with out the .exe to the new one. For some reason the new one normally will have the proper .exe and location needed. While this isn't a complete solution at least it's been working for me for the time being.
It happened with me today:
TL;DR; You might be using some C# code in your project who belong to a language version which is not supported by the .NET Framework version targeted by your project
Details:
I had two projects in my solution. One project was already existing. I added a new project targeting most recent .NET Framework v4.6.1 supported by Visual Studio(VS) 2017 class library project template. I used some C# language features which is present in C# v7.0. In such a case, VS can compile the project but can't create the output in bin directory.
Eventually I had to merge the new project code files into the existing old project which was targeting .NET Framework v4.5.1.
So I changed the target Framework version to the latest .NET Framework v4.6.1 for the existing projects also. Then the old project also started supporting my newly pasted C# language features.
In my case, the error appeared after I cloned my solution on a new machine.
I did not realise that the newly-cloned solution had AnyCPU set by default, when in reality my solution only supported x64. The compiler, however, did not return any error.
What pointed me in the right direction was the Output log, highlighted that of the 4 projects my solution was composed of, one of them was always skipped, i.e. only 3 were actually compiled. Scrolling up a bit the log, I noticed some message similar to MSIL mismatch between CPU versions.
Switching from AnyCPU to x64 solved the error for me.
(I then deleted the AnyCPU option from the Configuration Manager to avoid this issue in the future)
If you create a new "hello world" WM project, does it work?
If so, you can compare the solution files to check for differences that can cause this.
As far as I could tell, you need to "Save All" before building.

Resources