Installing SystemC for VS2013 - visual-studio-2013

I am using Windows 10 64-bit machine with Visual Studio Professional 2013 and I want to install SystemC. I downloaded SystemC 2.3.1 and I tried following the "Installation notes" provided but they're slightly outdated.
For one, it says "for VS 2005 and higher on Windows 7 machines" but I am using Windows 10, nevertheless I still tried to follow it. Second, the inclusion of src and lib files cannot be followed as stated there since this method was changed in VS2013. There seems to be no global setting anymore via Tools->Options->Projects->VCC++ directions tab.
Now, I was able to successfully buiold the SystemC.sln solution. However, when I tried to build an example project I got the following error:
LINK : fatal error LNK1104: cannot open file
'C:\Users\Andrew\Downloads\systemc-2.3.1a\systemc-2.3.1a\msvc80\SystemC\Debug.obj'
Even though I think I've correctly specified the src and lib directories in the project properties.
Can anyone explain how to build SystemC with VS2013 on Windows 10 x64?

Update: if you use CMake with Visual Studio, check Setting up a SystemC project with CMake: undefined reference to `sc_core
Currently I have no MSVC2013 installed, so here are steps for MSVC2017 that worked for me.
Download latest SystemC from http://accellera.org/downloads/standards/systemc
Open systemc-2.3.1a\msvc80\SystemC\SystemC.sln in Visual Studio
Visual Studio will offer to update solution, click ok. You can ignore report with warnings.
In VS menu bar set configuration to “Debug“ “Win32”. (In my case was already selected by default)
Build solution (F7)
In console, you may find messages like:
Unknown compiler version - please run the configure tests and report the results
You can ignore them. Solution should build without errors:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
As a result you will have SystemC.lib in systemc-2.3.1a\msvc80\SystemC\Debug
Now you can create some test SystemC project.
File->New -> Project -> Win32 Console application
Right click on project in solution explorer -> Properties
In Configuration Properties -> C/C++ -> General-> Additional include directories
Add path to: \systemc-2.3.1a\src
In Configuration Properties -> C/C++ -> Code generation -> Runtime Library
Select: Multi-threaded Debug (/MTd)
In Configuration Properties -> C/C++ -> Language -> Enable Run-Time Type Information
Select: Yes (/GR)
In Configuration Properties -> C/C++ -> Command Line -> Additional options
Type: /vmg
In Configuration Properties -> Linker -> General -> Additional Library Directories
Add path to: systemc-2.3.1a\msvc80\SystemC\Debug
In Configuration Properties -> Linker -> Input -> Additional dependencies
Add: SystemC.lib
Now it's time to type some code. For example this "Hello world":
#include "stdafx.h"
struct test_module : sc_module {
SC_HAS_PROCESS(test_module);
test_module(::sc_core::sc_module_name) {
SC_THREAD(test_thread);
}
sc_signal<std::string> message{ "message" };
void test_thread() {
message.write("Hello world!");
wait(1, SC_NS);
cout << message.read() << endl;
sc_stop();
}
};
int sc_main(int argc, char** argv)
{
test_module tmod{ "tmod" };
sc_start();
return 0;
}
In stdafx.h add:
#include <systemc.h>
Build project, it will fail with:
\systemc-2.3.1a\src\systemc.h(120): error C2039: 'gets': is not a member of 'std'
gets was removed from std namespace in latest MSVCs, but it is not really required.
So just open systemc.h and comment out Line 120:
// using std::gets;
In case you got error about sprintf
Add _CRT_SECURE_NO_WARNINGS to list of preprocessor definitions
Build again. Run without debugging (Ctrl+F5). You should see the following introduction test on your console:
SystemC 2.3.1-Accellera --- Feb 1 2017 14:43:06
Copyright (c) 1996-2014 by all Contributors,
ALL RIGHTS RESERVED
Hello world!
Info: /OSCI/SystemC: Simulation stopped by user.
Press any key to continue . . .
Hope that helps

Related

"The process cannot access the file 'Default.rd.xml' because it is being used by another process." on AppVeyor CI

I am doing some work on cordova-windows (https://github.com/apache/cordova-windows), which is using AppVeyor for testing on Windows. One of the things that was missing, were tests with Visual Studio 2017 (only VS2015 was used to test before). So I added those and it works like a charm - mostly.
Unfortunately we now have a very strange test failure:
https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-windows/build/1.0.458
Started
Creating Cordova Windows Project:
Path: testcreate 応用
Namespace: com.test.app
Name: 応用
Windows project created with cordova-windows#5.1.0-dev
Building project: C:\projects\cordova-windows\testcreate 応用\CordovaApp.Windows10.jsproj
Configuration : release
Platform : x64
Patching 10 in prebuild event...
Injected base.js reference to the www/index.html
Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.WinJS.2.0\/js\/base.js">\s*<\/script>)(\s*)/ from www/index.html
Removing /( *)(<script\s+(?:type="text\/javascript"\s+)?src="\/\/Microsoft.Phone.WinJS.2.1\/js\/base.js">\s*<\/script>)(\s*)/ from www/index.html
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\build\windows\release\x64\win10\CordovaApp.Windows10_1.0.0.0_x64.appx
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\build\windows\release\x64\win10\Upload\CordovaApp.Windows10_1.0.0.0_x64.appx
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\AppPackages\CordovaApp.Windows10_1.0.0.0_Test\CordovaApp.Windows10_1.0.0.0_x64.appxbundle
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\AppPackages\CordovaApp.Windows10_1.0.0.0\CordovaApp.Windows10_1.0.0.0_x64.appxbundle
CordovaApp.Windows10 -> C:\projects\cordova-windows\testcreate ??\AppPackages\CordovaApp.Windows10_1.0.0.0_x64_bundle.appxupload
Your package has been successfully created.
Building project: C:\projects\cordova-windows\testcreate 応用\CordovaApp.Windows10.jsproj
Configuration : release
Platform : x86
Patching 10 in prebuild event...
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2975,5): error MSB3231: Unable to remove directory "build\windows\bld\PackageUploadLayout\". The process cannot access the file 'Default.rd.xml' because it is being used by another process. [C:\projects\cordova-windows\testcreate ??\CordovaApp.Windows10.jsproj]
C:\projects\cordova-windows\testcreate 応用\cordova\node_modules\q\q.js:155
throw e;
^
Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe: Command failed with exit code 1
at ChildProcess.whenDone (C:\projects\cordova-windows\testcreate 応用\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
The relevant part is this:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(2975,5): error MSB3231: Unable to remove directory "build\windows\bld\PackageUploadLayout\". The process cannot access the file 'Default.rd.xml' because it is being used by another process. [C:\projects\cordova-windows\testcreate ??\CordovaApp.Windows10.jsproj]
This is not happening when I run the tests locally, meaning I can in no way reproduce what is going on here.
Any idea what process could block this Default.rd.xml file or build\windows\bld\PackageUploadLayout\?
How can I find out in a CI environment like AppVeyor?
Update:
Investigated a bit more by adding /clp:Verbosity=normal to the msbuild calls that are executed.
It runs a similar msbuild call 3 times (once per architecture). The first one succeeds, but during the second one the failure occurs. Makes sense as in the first iteration the folder doesn't exist yet, which it confirms with this output: Directory "build\windows\bld\PackageUploadLayout\" doesn't exist. Skipping..
The last output before the failure then is Removing directory "build\windows\bld\PackageUploadLayout\". which matches what we get in the error message. No indicator why the removing doesn't work though.
Super strange: With /clp:Verbosity=detailed added to the msbuild call, the build actually succeeds! My guess: Because the output takes time, whatever is having a lock on the folder or file releases it.
This is not exactly an answer, but rather investigation report. It is just not enough room comments to describe it. Here is what I did:
forked your repo
created AppVeyor project
added RDP
connected with RDP
installed procmon
added filter to monitor objects which path ends with bld\PackageUploadLayout\Properties\Default.rd.xml
run npm test manually from CMD
When the same error happened I see this:
I am not sure I understand why msbuild failed this way. I opened SHARING VIOLATION event, switched to process and see this:
What catches my eye is that msbuild version is 14. Should be 15 on Visual Studio 2017 image. We have version 14 installed for specific scenarios but default one is 15 (run where msbuild and you will see C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe). I am not sure where this path is set in your scripts, but I feel if you make it run correct msbuild version this may help.

visual studio 2015 c++ sddl.h does not appear as external dependency

I am trying to use the function ConvertSidToStringSid() in a Visual Studio 2015 Community, console project.
According to the msdn page
https://msdn.microsoft.com/en-us/library/windows/desktop/aa376399(v=vs.85).aspx
the requirements are:
Minimum supported client: Windows XP [desktop apps only]
Minimum supported server: Windows Server 2003 [desktop apps only]
Header: sddl.h
Library: Advapi32.lib
DLL: Advapi32.dll
I am using a Windows 10 Home, 64-bit computer. I have the *.lib and *.dll files respectively in :
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64\AdvAPI32.Lib
C:\Windows\System32\advapi32.dll
When i fill in the "#inclucde " in stdafx.h, I get no error from Intellisense. In contrast, "#include <blah.h>" gives a red wiggling underline under the 'include', and a mouse-over says 'Error: Cannot open source file "blah.h"'.
In my .cpp source file, which includes "stdafx.h", I add the code
BOOL OK ... ;
PSID owner;
char *sOwner;
OK = ConvertSidToStringSidW(owner, sOwner);
but then I get the red wiggle under ConvertSidToStringSidW.
In the solution explorer, under the project, under External dependencies there are files SCardErr.h and sdkddkver.h, but nothing, no sddl.h, between these two. (And, by the way, sddkver.h defines _WIN32_WINNT_THRESHOLD 0x0A00. Testing with IntelliSense in the editor, _WIN32_WINNT is also 0x0A00.)
When compiling, I first got an error message that the file sddl.h could not be found. I have multiple copies on the computer, and added to the "Additional include directories" for all configurations, the directory
C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared
Compiling still fails with "identifier xxx is undefined" and 'xxx': Identifier not found, from IntelliSense and Build respectively.
The header sddl.h is still not in the external dependencies. Right-clicking on the sdksddkver.h I get its full path: The newly added additional include directory. I don't know what it was before I added this include directory.
Right clicking on the include directive in stdafx.h, I can open sddl.h. The editor shows parts of the contents in a light grey color, when the contents is guarded by an #if/#ifdef directive whose argument is false. However, the function I want to use, ConvertSidToStringSid, is shown in full color.
Unsure if its a clue that the error messages say "defined" rather than "declared". In the project properties, linker, input, additional dependencies, the file advapi32.lib is listed.
What am I doing wrong?
I found the solution myself. The problem was that I had two projects in the same "solution", each with its own stdafx.h file. I had the wrong stdafx.h file open in the editor, and placed the #include directive in the wrong file.
-Thanks

Error while trying to generate UMDF 2.0 driver from template

I installed Windows 10 build 10163 and Visual Studio 2013 Ultimate edition on a clean machine, and then added the Windows SDK, WDK, and VSDEV12_WDK based on the specified OS version.
I'm trying to create for the first time a UMDF 2.0 driver by using
File -> New -> Project -> Template -> Visual C++ -> Windows Driver -> WDF -> User Mode V2 Empty, and receive the error below. I would appreciate any help.
C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.Default.props(13,5): error MSB4186: Invalid static method invocation syntax:
"[Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')".
Method 'Microsoft.Build.Utilities.ToolLocationHelper.GetLatestSDKTargetPlatformVersion' not found.
Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). [D:\Workspace\
gcp\gnssAdaptation\winAdaptation\WinPhone\64-bit\gnssDriver\gnssDriver Package\gnssDriver Package.vcxproj]
Done Building Project "D:\Workspace\gcp\gnssAdaptation\winAdaptation\WinPhone\64-bit\gnssDriver\gnssDriver Package\gnss
Driver Package.vcxproj" (Clean target(s)) -- FAILED.

'iostream': No such file or directory [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Installation of Visual Studio 2010 (any edition) installs only 2 files in the C++ headers directory
I am so desperate Right now its not funny I have searched the entire internet for the answer and its not working.... i have installed and reinstalled visual studio 2010 pro at least 4 times and it doesnt fix anything..... heres my problem
I try to make a simple Hello world project and boom it fails saying this..
#include<iostream>
using namespace std;
int main()
{
cout << "Hello World.." << endl;
return 0;
}
1>------ Build started: Project: ds, Configuration: Debug Win32 ------
1>Build started 1/21/2013 12:31:36 PM.
1>InitializeBuildStatus:
1> Touching "Debug\ds.unsuccessfulbuild".
1>ClCompile:
1> d.cpp
1>c:\users\dj\documents\visual studio 2010\projects\ds\ds\d.cpp(1): fatal error C1083:
Cannot open include file: 'iostream': No such file or directory
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.32
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
my include folder in VC only has these names
ammintrin
omp
pgobootrun
srv
wmiatlprov
Im not to great with this so if ur gonna answer can you put it noob terms:)
Thank you in advance..
When you choose console aplication check the option: include precompiled header, most likely you created an empty project in which case you must manualy add the path to iostream file
in .vcxproj directory includes you should have:
Include Directories $(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;
and
Library
$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib
if you have these and stdafx.h include in cpp but still no path to iostream you should check PATH environment variable not to be broken or any of the variables $(VCInstallDir) $(WindowsSdkDir) $(FrameworkSDKDir)

LNK1000: Internal error during IMAGE::BuildImage

I have a problem with linking in VC++ 2010. When I compile in the debug mode it's ok, but in the release mode I regular receive the error "LNK1000: Internal error during IMAGE::BuildImage".
What am I doing wrong?
It began work as soon as I have changed "Whole program optimization" option from "Use Link Time Code Generation" to "Profile Guided Optimization-Instrument".
I encountered the same error. The problem in my case was that I was "playing" with the configuration properties (Project Properties -> Configuration Properties -> General)
The 'Configuration Type' of the project was 'Dynamic Library (.dll)', but the 'Target Extension' was .lib instead of .dll.
April 2020 update
Issue with MSBuild and Docker for Windows was fixed in MSBuild 16.5 (source), so if still seeing that - just update MSVS/MSBuild to the latest version
Original answer
Check for working C compiler: C:/BuildTools/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/BuildTools/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
......
LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage.FinalPhase
I was getting this error when I was running cmake in Docker for Windows inside mounted Docker volume. Solution is to copy the workspace to local Docker filesystem.
In vs2019 it works for me:
Project->Property pages->Optimization->Link Time Code Generation, change from "Use Link Time Code Generation" to "Profile Guided Optimization-Instrument"

Resources