I am using Sublime Text 3 (build 3126) with g++ on Windows 10 x64 to compile my c++. My code so far is:
#include <stdio.h>
#include <windows.h>
#include <wincrypt.h>
#include <string>
using namespace std;
int main() {
return 0;
}
But when I compile, I get the error
wincrypt.h: No such file or directory.
I have also tried using Visual Studio 2015, but when I build it always gives me the error
Cannot open include file: 'stdio.h': No such file or directory
Any help is appreciated, thanks.
Related
I've looked online for how to play a audio file on C++ and looked at videos but most of them say to change the 'linker' to winmm library. The problem I have is finding where to change the properties in VSCode 2019. Also, when I try to use #Include it would show an error. Example:
#Include "stdafx.h"
#Include <Windows.h>
#Include <playsoundapi.h>
int main()
{
PlaySound(TEXT("C:\Users\User\Desktop\Sound\Blop.wav"), NULL, SND_FILENAME);
return 0;
}
My goal is to just play an audio file using C++ from VSCode.
Error -: cannot open source file "stdafx.h"´ ´cannot open source file "Windows.h"´ ´#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\User\Desktop\Sound\Audio.cpp).´ ´cannot open source file "playsoundapi.h"
It is not #Include. It should be correct as #include
I already was a problem seem like you. So, by my experience, I think "#Include "stdafx.h" is the problem, you can't use "stdafx.h" in VS 2019 (Microsoft Visual Studio Comunity 2019), "stdafx.h" work very well in VS 2017 (Microsoft Visual Studio Comunity 2017), but "stdafx.h" was replaced by #include "pch.h"in VS 2019, in other words, you should use #include "pch.h" and not "stdafx.h". And more, you have to include the winmm.lib in linker/imput/aditional dependencies, so if you follow this link you can see how to include winmm.lib (https://www.youtube.com/watch?v=9WeDQHi6sJs). So, to VS 2019 you can use this code below, I use this code in VS 2019 and it works very well for me. The song that you would like to play should have to stay in the right directory, the name of the file that stays my .cpp code is teste_0027 (C:\Users\Rodrigo\source\repos\teste_0027\Debug), the file has to stay in .wav format, and more, when you will create the c++ project in VS 2019 you should create the project as model "Aplicativo de Console CLR" in my language (Portuguese-Brazil), in your language it should sound like "Console App CLR"...
#include "pch.h"
#include <iostream>
#include <windows.h>
#include <MMSystem.h>
using namespace System;
using namespace std;
int main()
{
bool played = PlaySound(TEXT("ALAN-WALKER-Faded-Different-World-feat-Julia.wav"), NULL, SND_SYNC);
cout << " Sucess or not " << played << endl;
system("pause");
return 0;
}
I'm using Microsoft Visual Studio Community 2017 on Windows 10 and I've been trying to install GLUT using this online guide that I found on this StackOverflow question. However, when I try to compile my code this error still shows up: fatal error C1083: Cannot open include file: 'GL\glut.h': No such file or directory. I've followed every single step line by line, but nothing seems to work. What could be causing this error?
This is how I'm importing the dependencies:
#include <iostream>
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/GL.h>
#include <GL/GLU.h>
#include <GL/glut.h>
#include <cstring>
#include "math.h"
#include <conio.h>
For this, I like to use the Nuget package manager. If you go to
Tools>NuGet Package Manager>Package Manager Console
Then, in the console type:
Install-Package nupengl.core
Your problem should be fixed.
i know its a duplicated question but none of the solutions i found worked for me.
i created new CLR empty project and this error appeared so i searched for solution and none of them worked for me except that i close myform.h and opened it again from the solution explorer and was working fine then i installed opencv from the NuGet Package Manager and when i added the includes
#include "opencv2\core\core.hpp"
#include "opencv\cv.h"
#include "opencv\highgui.h"
#include "opencv2\opencv.hpp"
that error appeared
Error LNK1104 cannot open file 'C:\Users\OneDrive\Documents\Visual Studio 2015\Projects\algorithms\projectimage\x64\Debug\projectimage.exe'
then i also searched for solution and none of them solved it so i tried closing the whole project and open it again, the two errors appeared together and i tried closing myform.h and opening it again but it doesnt go away so any help in solving the two errors please
My Main
#include "MyForm.h"
using namespace System;
#include "opencv2\core\core.hpp"
#include "opencv\cv.h"
#include "opencv\highgui.h"
#include "opencv2\opencv.hpp"
using namespace System::Windows::Forms;
[STAThread]
void main() {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
projectimage::MyForm form;
Application::Run(%form);
}
NOTE: am using visual studio 2015 and opencv version 2.4.11 c++
I am working on Windows 10 and I downloaded Boost 1.60 for Visual Studio 2015.
My first code snippet looks as:
#include <boost/thread.hpp>
#include <vector>
#include <iostream>
#include <sstream>
#include <cmath>
#include <iostream>
using namespace std;
void main()
{
std::cout << "Hello World";
}
I get the error:
>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc140-mt-gd-1_60.lib'
I have provided path for boost and also libraries as shown in pics:
You need to compile the library before using it. Here's how to compile it:
In your Windows Start menu open the "Developer Command Prompt for VS2015". Then inside the opened command prompt, execute those commands:
cd C:\boost_1_60_0
bootstrap.bat
.\b2 runtime-link=shared toolset=msvc-14.0
Wait for a couple of minutes, since compilation takes a while.
Specify in your project in Linker -> General, the Additional Library Directories path as C:\boost_1_60_0\stage\lib, and in C++ -> General the Additional Include Directories path as C:\boost_1_60_0
You should now be able to compile your code without problem.
I am trying to explore the CString Data type which is used extensively in my company's test program.
Here is the code:
#include <iostream>
#include <string>
#include <afx.h>
using namespace std;
int main()
{
CString cs("meow");
wcout << cs << endl;
return 0;
}
The above code compiles with 0 errors. However, when I try to build it, I get the following error.
fatal error C1083: Cannot open include file: 'atlstr': No such file or directory
I am using Visual C++ 6 Standard Edition for development.
Please note that my company's test program can compile and run well and I don't get the aforementioned error.
Is there a place where I can download the atlstr include file?