How to compile program that uses boost::filesystem? - c++

I'm trying to compile a sample program that uses boost::filesystem:
#define BOOST_FILESYSTEM_NO_DEPRECATED
#include <boost/filesystem.hpp>
int main()
{
boost::filesystem::path full_path(boost::filesystem::current_path());
std::cout << "Current path is : " << full_path << std::endl;
}
I've downloaded and compiled boost 1_72, added my_path_to_boost to include directories and my_path_to_boost\stage\lib to include lib directories
When I try to compile the program, I'm getting following error:
Severity Code Description Project File Line Suppression State Suppression State
Error LNK1104 cannot open file 'libboost_filesystem-vc142-mt-gd-x64-1_72.lib' current-path D:\My Projects\filesystem\current-path\LINK 1
I have verified that libboost_filesystem-vc141-mt-gd-x64-1_72.lib is located in my_path_to_boost\stage\lib.
I'm using Visual Studio 2019
What am I missing? Is there any way I can see where VS is looking for the file?

Related

How to use a C++ library method in a visual studio project

I'm trying to test a method from a static library that I created. The method from the library just prints something to the console. I have added the directory in the properties tab and added the linker input. However, the project still does not recognise the library. Would anyone be able to help. Any help is appreciated.
Libary header:
void TestLiabry();
Libary method:
void TestLiabrys()
{
cout << "Hello" << endl;
}
Project I want to use the method in:
#include <iostream>
#include "TestLibary.h"
int main()
{
std::cout << "Hello World!\n";
TestLiabry.TestLiabry();
}
I added the library in the linker like this:
Linker -> Input -> Additional Dependencies -> C:\Users\jorda\Downloads\TestLiabry
It pops out this error:
Severity Code Description Project File Line Suppression State
Error MSB6006 "link.exe" exited with code 1104. Project1 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets 1010
And this lnk error:
Severity Code Description Project File Line Suppression State
Error LNK1104 cannot open file 'C:\Users\jorda\Downloads\TestLiabry.obj' Project1 C:\Users\jorda\Downloads\Project1\LINK 1
There seemed to be an error in my linking of the path to the library where I didn't include the library .lib. Only include the path and not the path and lib file in the directory.

cannot open include file 'Graphics.hpp' no such file or directory ,additional include for visual studio not working

i m trying to use sfml in my project using visual studio 2019. Following sfml documentation to perform setup for visual studio i have performed all the action required
i have included include folder in c/c++/additional include directory and also provided path for lib folder in linker setting and also provided additional dependencies in linker/input
but
#include <iostream>
#include <SFML/Graphics.hpp>
int main()
{
std::cout << "i cant tolerate" << std::endl;
return 0;
}
this code shows above mentioned error ,
cannot open include file 'Graphics.hpp' no such file or directory
it seems like include path is not working
how can i solve this issue
i tried many times but got same result
if anyone facing the same problem please check the platform in the project/properties win32 worked for my particular problem

What are the standard include paths for MS Visual C++?

I am trying to build a hello-world C++ application using Microsoft Visual C++.
#include <iostream>
int main() {
std::cout << "Hello, world. " << std::endl;
return 0;
}
I get this error:
main.cpp(1): fatal error C1083: Cannot open include file: 'iostream': No such file or directory
What are the standard include paths for Microsoft Visual C++?
Note: I am building from the command-line, not from Visual Studio
I actually just read through all of the documentation on this at: https://msdn.microsoft.com/en-us/library/ms235639.aspx
The material looks detailed and complete. If you get things configured like they require then it must work. They provide plenty of checks and conditions for ensuring that you are set up properly.
I am seriously suspecting that you aren't using a developer command prompt window.
I just did it myself and it works. Use Notepad and name the files like they tell you to do.
"Hello world!!"

fatal error C1083 during build of program to test CStrings

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?

C++ LInker error (Visual Studio C++ 2010)

I tried to create empty project for Visual Studio.
// OpenGL1.cpp : main project file.
// #include "stdafx.h"
#include "windows.h"
#include <GL/gl.h>
#include <iostream>
using namespace System;
int main()
{
std::cout << "Hello World" << "\n";
return 0;
}
Having configured these dependencies:
opengl32.lib;glu32.lib;olepro32.lib;%(AdditionalDependencies);C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl;
And I got this error:
.NETFramework,Version=v4.0.AssemblyAttributes.cpp
LINK : fatal error LNK1104: cannot open file 'C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl.obj'
Can you explain why this happens and how to remove the error?
The "dependencies" refer to the filenames of libraries which the linker should use, not to include paths. Include paths are for the compiler, not for the linker.
You must first tell the linker where to find the OpenGL library file:
http://msdn.microsoft.com/en-us/library/1xhzskbe%28v=vs.100%29.aspx
And then, as a dependency, you specify only its name, not a full path. In this case, opengl32.lib.