#include <iostream>
usingnamespace std;
#include "ThreadLib/ThreadLib.h"
void PrintThread( void* data )
{
// convert the data passed in into a character.
char c = (int)data;
for( int i = 0; i < 10000; i++ )
{
cout << c;
cout.flush();
}
}
int main()
{
ThreadLib::ThreadID a, b;
a = ThreadLib::Create( PrintThread, (void*)'a' );
b = ThreadLib::Create( PrintThread, (void*)'b' );
ThreadLib::WaitForFinish( b );
ThreadLib::WaitForFinish( a );
char c;
cin >> c;
return 0;
}
#include "ThreadLib/ThreadLib.h"
cannot open source file "ThreadLib/ThreadLib.h"
Which I'm assuming is due to a deprecated method used in VC6. There is a folder in the Solution Explorer called ThreadLib that has the following files:
I'm sure there's a way in Visual Studio 2015 to make a Library but I don't know how. When I try to open the solution I'm getting the following migration warning:
"Due to the requirement that Visual C++ projects produce an embedded (by default) Windows SxS manifest, manifest files in the project are now automatically built with the Manifest Tool. You may need to change your build in order for it to work correctly. For instance, it is recommended that the dependency information contained in any manifest files be converted to "#pragma comment(linker,"<insert dependency here>")" in a header file that is included from your source code. If your project already embeds a manifest in the RT_MANIFEST resource section through a resource (.rc) file, the line may need to be commented out before the project will build correctly."
I haven't used that particular version of VS, but I'd be very surprised if it's deprecated the #include statement. What's more likely is that you haven't set up your include paths properly in your project.
Implementing a user-created library in VS is a two-step process:
1. create/compile the library.
2. add the .lib file to another project that uses the library.
VS allows combining separate but related projects into a single solution, there are differences if you are creating a static or dynamic library.
Walkthrough: Creating and Using a Static Library (C++)
https://msdn.microsoft.com/en-us/library/ms235627.aspx
Walkthrough: Creating and Using a Dynamic Link Library (C++)
https://msdn.microsoft.com/en-us/library/ms235636.aspx
The biggest stumbling block to getting user-created libraries to work is forgetting to add the path(s) to the library to your solution/project path statements.