Using actor framework in Visual Studio - c++-actor-framework

This is my first time working with actor framework in windows. I am having success building the examples using CMake however when I open the generated project using Visual Studio I am seeing many errors. It is strange because I can build and run the project in VS even though it reports hundreds of syntax errors.
I have tried two different approaches, both with similar results:
Approach I: Conan
Create new directory then add hello_world.cpp and this conanfile.txt
[requires]
caf/0.18.5
[generators]
cmake
Create build directory and from there run conan install ..
Added the following CMakeLists.txt in the working directory:
cmake_minimum_required(VERSION 2.8.12)
project(CafHelloWorld)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(hello_world hello_world.cpp)
target_link_libraries(hello_world ${CONAN_LIBS})
run cmake .. G "Visual Studio 16"
run cmake --build . --config Release
The exe runs great but when I open the project in VS, it reports hundreds of syntax errors (mostly in the caf header files). I can build and run the project from VS though.
Approach II: Source
Download source from github and add build directory
Open CMake GUI and point to source and build directories
Press "Configure" and select "Visual Studio 16 2019"
CMake complains about OpenSSL. I disable the OpenSSL Module(don't think I will use it) then hit configure again. Error goes away.
Hit "Generate" then "Open Project"
The result is similar. hello_world.cpp has a handful of errors and Visual Studio reports hundreds more from the caf header files. The project builds though. Am I missing something obvious?

Related

AssemblyInfo ingrored when building from GitLab-Runner

On a Windows machine there is a GitLab-Runner run from a domain user with admin rights. When I log as this user and call dotnet build -c release to build an ASP.NET Core app, the dll has all the information from the AssemblyInfo.cs file. When I do the same as part of a CI job, the produced dll is missing all this information (for example the version number).
The AssemblyInfo.cs file is not part of the repository, instead, it is produced by a prebuild event (using gitWCRev.exe tool). However after running some tests I can see that the AssemblyInfo.cs is actually generated when the job is run by the runner.
Any help as to why the file is ignored and how to overcome this issue would be appreciated.
At first I thought that this might be related to Pre-build task of Visual Studio project fails in GitLab Runner issue, but I don't get any build errors.
On the same machine, I build a .Net Framework app which has the same AssemblyInfo setup, but is compiled using msbuild /property:Configuration=Release by the runner and the produced dll file has all the expected information.
It turns out the problem was partially related to the AssemblyInfo.cs file not being part of the repository.
SDK-style csproj normally don't list the files in the project, but figure them out based on the folder contents. When dotnet build was run, AssemblyInfo.cs wasn't present in the project directory (GitLab-Runner usually clears out files not present in the repository before starting a job/pipeline), so build tools had no idea they needed to load it. It made no difference that the file was being created by the build tools.
The solution proved to be creating an empty AssemblyInfo.cs file before running dotnet build. This way build tools knew they needed to compile it. Actual compilation still happened after prebuild events, so all the needed information was there.
I created the empty AssemblyInfo.cs file using PowerShell:
New-Item -Path "Properties/AssemblyInfo.cs" -ItemType File
Also, checking the build logs helped me finally figure it out. To get the build logs I've called build tools like this:
dotnet build -c release /flp:v=diag
The .Net Framework app didn't have this problem because it wasn't an SDK-style project. All the files needed for compilation were listed in the project file and build tools knew to load them, even if they were created during the prebuild event.

R Xgboost: How to compile xgboost with GPU support on windows 10; can't find Visual Studio [duplicate]

When I am trying to install CMake I get the error:
Visual Studio 15 2017 could not find any instance of Visual Studio.
I am using Windows 7 and Visual Studio 2017. The CMakeOutput.log file writes:
The system is: Windows - 6.1.7601 - AMD64
Any ideas?
I ran into the same error and performed the following steps to resolve the issue:
Open Visual Studio
Go to Tools -> Get Tools and Features
In the "Workloads" tab enable "Desktop development with C++"
Click Modify at the bottom right
These steps resulted in the "Visual C++ tools for CMake" feature being installed, but the other optional C++ features included in this workload may also helpful for what you are trying to do.
After the Visual Studio updater finishes installing try re-running the command. You may need to open a new command window.
In my case, I installed Visual Studio, selecting the workloads and modules that I wanted, but I ignored the request to reboot, assuming that shutting down the computer at the end of the day and restarting it the following day would suffice. I was wrong.
The following day I tried a cmake build and got the "could not find any instance of Visual Studio" error. After several attempts to resolve, I re-ran the installer, made no changes to the configuration, and clicked Modify. This time I let it reboot the computer. The reboot took a long time. After which my cmake build worked.
If you have already installed the workload Desktop development with C++ and still getting the following errors while using visual studio 2022 for flutter
Generator
Visual Studio 16 2019
could not find any instance of Visual Studio.
Building Windows application...
Exception: Unable to generate build files"
Solution: Follow these steps,
Edit your_flutter_path\packages\flutter_tools\lib\src\windows\build_windows.dart, and change the constant on line 28 from Visual Studio 16 2019 to Visual Studio 17 2022
Delete flutter_tools.stamp and flutter_tools.snapshot from your_flutter_path\bin\cache\
Run flutter clean in the project
I had the same issue "could not find any instance of Visual Studio"
but with Visual Studio 2019 (Community Edition) and I just had to configure the VS160COMNTOOLS variable so that CMake correctly detects Visual Studio.
export VS160COMNTOOLS="/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools"
(cf https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html)
With Visual Studio 15 2017, the variable you need should be VS150COMNTOOLS.
(cf https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html)
NB: in my case, in a Travis-CI workflow, I installed Visual Studio using the commands (no need to reboot):
choco install visualstudio2019community
choco install visualstudio2019-workload-nativedesktop # required
With only the first package, CMake detection of VS2019 failed.
I was configuring a Jenkins build node and could successfully run CMake GUI manually but command line use or builds using the CMake plugin would fail with:
Visual Studio 16 2019 could not find instance of Visual Studio.
-A x64 parameter was added with no change in result.
The problem was that CMake could not determine the Windows SDK version.
By adding CMAKE_SYSTEM_VERSION parameter CMake was then able to find Visual Studio.
-D CMAKE_SYSTEM_VERSION=10.0.18362.0 (use your windows SDK version)
Environment:
windows 10 system build: 19042
CMAKE 3.19.4
VS 2019 Professional 16.8.4
Jenkins 2.235.1
Full command line that worked:
"C:\Program Files\CMake\bin\cmake" -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE=Release -A x64 -D CMAKE_SYSTEM_VERSION=10.0.18362.0
When using VS 2017, be aware that this is really VS 2015, and CMake identified it as VS 2017 2022 which is not the version of VS 2017 I had, that gave me this error. So the conclusion I offer is to try different versions, specifically the 2015 one.
I had a similar issue where installing libzmq in my npm project was throwing the same error and that wasn't getting solved by enabling "msbuild" under "Desktop development with C++" in the Visual Studio installer.
My solution ended up being to reinstall the Windows build tools for npm with the following command.
npm install --global windows-build-tools
Note: Remember to run the command prompt (or whatever terminal you are using) as admin before running this.
If the CMake used to work with the installed Visual Studio and is broken someday, then the problem could be VS requires system reboot to complete some update.
For quick verification, rename HKLM\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\Setup\Reboot to like HKLM\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\Setup\Reboot.bak, then re-run cmake which should succeed. Don't forget to rename the registry back and reboot the system if this is the problem.
In my case, I was selecting different version of visual studio in that configuration dialog box whereas I installed different version.
Do select the same version.
Above solutions did not solve this issue for me. After installing node.js from https://nodejs.org/en/download/ apparently a correct version of windows-build-tools was installed
I reinstalled the Visual Studio 2019(my former one is 2017 version ) with all those settings required(my cmake version is 3.23.0),and it works. So try to install different versions.
In my case, the problem was gone after I deleted the previous cmake result directory and then ran cmake again.
if you have installed two or more Windows 10 SDK, delete them excluding latest one.
Try downloading the windows-build-tools package.
npm install --global --production windows-build-tools --vs2015
This step should be the end-all-be-all solution to fixing node-gyp problems. For most people, that’s true. NPM has a package called windows-build-tools that should automatically install everything you need to get node-gyp working, including the Microsoft build tools, compilers, Python, and everything else required to build native Node modules on Windows.

MSBuild not compiling with both /p:Configuration=Release and -p:Configuration=Debug

We are attempting to install a clean build of the newest version of Kentico (12) on Azure, using Kudu, in DEBUG configuration. We traditionally accomplish this by setting SCM_BUILD_ARGS to -p:Configuration=Debug, and all is well. But for some reason in this newer version, the project fails to compile, and I see that this is the command being run:
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "C:\Users\User\Documents\GitHub\Project\CMS\CMSApp.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="C:\local\Temp\8d6d315018f5ff9";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="C:\Users\User\Documents\GitHub\Project\.\\" -p:Configuration=Debug
Notice both Configuration=Release and Configuration=Debug. The compilation errors are things like Invalid expression term 'string' on the following line of code:
bool licenseOK = LicenseHelper.CheckLicenseLimitations(FeatureEnum.Ecommerce, out int skuCount, out int maxSKUCount);
This doesn't highlight at all in Visual Studio in Debug or Release mode. I am also able to reproduce locally (as shown in my paths above), and if I change the two configurations to both be the same (regardless of whether I choose Debug or Release), it compiles just fine.
What I know I can do is create my own custom deployment command script file as a work-around, but I guess I don't understand why the above MSBUILD command isn't working in the first place.
Any ideas as to why this would work great for all of my ASP.NET projects prior to this one? One thing I know is that Kentico recently included the Roslyn compiler, which I am unfortunately not that familiar with - could that be part of the issue?
UPDATE #1: It appears all of the compilation errors have to do with code that is only valid in C# 7.0. That could be a clue.
It all came down to the fact that the newer versions of Kentico had code that was only valid in C# 7, and required MSBuild 15 to compile. Here's how I was able to set up Kudu:
Add a file named .deployment in the root of my repo, containing only the contents below. This tells Kudu to use a custom deployment script.
Download the deploy.cmd file from my Azure App Service via FTP to the root of my repo, and update it per https://github.com/projectkudu/kudu/issues/2350#issuecomment-373817740 to use the MSBuild 15 path. Details below.
.deployment file contents
[config]
command = deploy.cmd
deploy.cmd updates
1 - Add -MSBuildPath "%MSBUILD_15_DIR%" to nuget call. Example:
nuget.exe restore "{your .sln file path}" -MSBuildPath "%MSBUILD_15_DIR%"
2 - Replace %MSBUILD_PATH% with %MSBUILD_15_DIR%\MSBuild.exe in both occurrences under step 2. Build to the temporary path
This was all that was needed in order to get the build to complete.
As Keith mentions, it was a compatibility issue with C# 7.0 that Kentico 12 uses. This SO thread mentions that you need to run MSBuild version 15 for C# 7.0 code. I ran a similar debug command for my local Kentico 12 project using MSBuild 15, and it succeeded.

make qt5.3.1 .pro file from Visual Studio 2013 project

I wrote a little Qt utility in VS2013. It works fine when running from IDE - even debugging is great. But VS doesn't generate usable exe (error 0xc000007b - "The application was unable start to work correctly", after I've installed all required qt's dll's).
Is there any way to compile everything and correctly from VS? To make really runnable exe?
Or - How can I write correct pro file for qmake?
I tried to write some. qmake generated from it makefile without any erros, but running VS's nmake it gives a "fatal error: U1077 return code '0x2'".
As I think it is problem with linker - even I wrote for all used modules all required QT += lines.
Can anybody help? I think I'm not alone who met this problem.
Thanks.
When you get an error like you got it means you have some dlls missing. You can only find out what dlls are missing using DependencyWalker.
*.pro files can be generated from Visual Studion using the Visual Studio Add-in for Qt4 or with Visual Studio Add-in for Qt5 depending on your Qt version.
If you have a Qt/VS application you want to deploy, AFAIK the following dlls are needed:
Qt5Core.dll
Qt5Gui.dll
Qt5Widgets.dll
platforms (folder)
qminimal.dll
qoffscreen.dll
qwindows.dll
icuin52.dll
icudt52.dll
icuuc52.dll
YourApplication.exe
For more information see http://qt-project.org/doc/qt-4.8/deployment-windows.html

How to build Qwt on Windows

Here's what I've done:
Downloaded qwt-4.2.0-setup-qt230nc.exe from sourceforge
Unpack to C:\Program Files\Qwt
Go to Qt Command Prompt
Run msvc-qmake.bat.
Get the output.
Now the lib directory is created, but it's empty. Also tried opening VS project file, but it doesn't converse to VS2008, because there are no vcproj files. I also tried to do it qmake way:
qmake qwt.pro and then make, but it says make is not recognized. I figured that I could use mingw32-make, but I gave me a lot of compiler errors.
I was hoping I would use Qwt within QtCreator, but sadly failed. Any help appreciated.
I think I've come up with easy solution:
Open QtCreator.
Open project... -> C:\Program Files\Qwt\qwt.pro
Build.
...
PROFIT!!!
Do I guess correctly it's valid way to do this?
Now I need to figure out how to marry it with QtDesigner since there is no Designer Plugin in here...
If you have Visual Studio you must to do next steps (according to file "INSTALL"):
run console
change directory to directory where you installed QWT
type "qmake qwt.pro"
type "nmake"
You must be ensured that nmake.exe and qmake.exe in your PATH environment variable.
P.S. Easy way to add nmake.exe (its Visual Studio's make realization) is to run "tools/visual studio 2008 command prompt" from main menu of visual studio.

Resources