I'm using visual studio code to code swift on my windows pc i installed the latest swift version which is swift 5.3
after that i downloaded the extension of swift on visual studio code called Swift language and i downloaded code runner, i made a .swift file and started coding on it when i press on run code
this is the error that show up
C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/SwiftStdint.h:28:10: error: 'stdint.h' file not found
#include <stdint.h>
^
:0: error: could not build C module 'SwiftShims'
try putting these commands in the terminal, it should work.
set SDKROOT=%SystemDrive%/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk
set SWIFTFLAGS=-sdk %SDKROOT% -I %SDKROOT%/usr/lib/swift -L %SDKROOT%/usr/lib/swift/windows
swiftc -o example.exe example.swift %SWIFTFLAGS%
Note - For the last command replace example before .swift and .exe with the name of your file.
Related
I can't get VS Code to play nice with WxWidgets on Linux or MacOS. It seems like it's trying to default to MSW and gives an error (detailed below)
The specific question is about VSCode (autocomplete, don't give false errors) with WxWidgets. In command prompt, compiling any Wx project works perfect.
Steps:
VS Code is installed
-Create folder for project. Let's call it /src/hello
-Create a hello.cpp file with code from: https://docs.wxwidgets.org/3.0/overview_helloworld.html
-Download WxWidgets into /src/hello/deps
-Going through steps to compile and install Wx https://docs.wxwidgets.org/trunk/plat_osx_install.html
-Check my Intellisense includes to include ${workspaceFolder}/**
-Now, in the command prompt, if I run:
g++ hello.cpp 'wx-config --cxxflags --libs' -o hello
./hello runs perfect!
But in VSCode is unusable because it's giving me this error:
cannot open source file "../../../lib/vc_lib/msw/wx/setup.h" (dependency of "wx/wxprec.h")
I'm pretty sure msw is for windows?
I feel like I've tried everything:
-Downloaded and Git version of Wx (Yeah, I know it's the same. But people on the wx forums recommended trying...)
-Use the Homebrew WxWidgets install.
-Using the sample projects included with Wx.
-Using the Hello World
-Same issues in Linux and MacOS.
-Updating Intellisense's includes every way you can think of.
-Using the output of wxconfig and putting the cxxflags and lib include output into Intellisense.
Is anyone able to use VS Code on Linux or MacOS with the Hello World Wx example? If so what are your intellisense settings?
My properties:
I'd rather not use Cmake for this.
I've installed Swift 5.6.1 on my Windows 10 machine, including all the necessary Visual Studio components, but I can't seem to build anything. Even just running the following set of commands in git bash results in an error:
mkdir swiftTest
cd swiftTest
swift package init --type executable
swift build
Specifically, the swift build command gives the following errors:
warning: Failed creating default cache location, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
'swiftTest': error: invalidManifestFormat("Missing or empty JSON output from manifest compilation for swiftTest", diagnosticFile: nil)
The error message seems surprisingly rare -- the top google results were the source of the program that generated that error, and an unrelated error with similar wording from a ReactJS application.
Do I just have to add some flags to the swift build command, or is there something else wrong with my setup?
In my case what fixed it was invoking the command from a Visual Studio Developer Command prompt.
I am trying to compile a project using the libusb-1.0 library. When i compile from cmd with the following command
gcc -g main.c -o test.exe -lusb-1.0
my program compiles just fine. However if I try to use the Powershell window inside VSC i get this error
gcc.exe: error: .0: No such file or directory
I've run the same code from both terminals.
While I still can compile and run my code, it would be convenient if I could do it from within VSC.
How can i fix this error?
Try with (double) quotes around the -lusb-1.0 parameter.
I am following some tutorials, basically trying to start an echo server in swift, without xcode, just command line and plain text editors, so I can get a grasp of the ecosystem
but I found this error for which there seems to be no solution already online
swift package init --type executable
error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.14.xctoolchain/usr/bin/swift-package (No such file or directory)
It looks like I was pointing to the Swift compiler in the OS toolchain (which doesn't have swiftpm)
So after running
export TOOLCHAINS=default swift package init --type executable
The command worked successfully
I have tried to install the libsvm package with
mex -setup
(since "make" resulted in an error). This was followed by one choice for a compiler, so I chose "1".
Afterwards I typed in "make" got the following error though:
xcrun: error: SDK "macosx10.7" cannot be located
clang: warning: no such sysroot directory: '-mmacosx-version-min=10.7'
libsvmread.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
mex: compile of ' "libsvmread.c"' failed.
If make.m fails, please check README about detailed instructions.
What can I do?
I think the following answer from the matlab support might be helpful (http://www.mathworks.com/matlabcentral/answers/103904-can-i-use-xcode-5-as-my-c-or-c-compiler-in-matlab-8-1-r2013a-or-matlab-8-2-r2013b):
The Mac OS X 10.7 SDK, available in Xcode 4.1 through 4.6, is used by
MEX and related capabilities. This SDK is no longer available in Xcode
5, resulting in errors similar to the following when compiling:
xcodebuild: error: SDK "macosx10.7" cannot be located.
xcrun: error: unable to find utility "clang", not a developer tool or
in PATH
The simplest solution is to avoid updating Xcode to version 5 if you
are using R2013a or R2013b. If you need Xcode 5, or you have already
irreversibly upgraded to it, you can update MEX to use the 10.8 SDK:
In the MATLAB Command Window, execute the following commands:
cd(matlabroot)
cd bin
edit mexopts.sh
Save a backup copy of this file somewhere in case you make a mistake and you need to revert your changes.
Scroll down to the Mac (“maci64”) section of this file, beginning around line 120.
Replace all instances of 10.7 with 10.8; there are four of these in all (a fifth may be found in comments only)
Save the file, then execute the following command in the MATLAB Command Window:
mex -setup
Please note that this workaround links MEX files with a different SDK
than with which MATLAB was tested. Although there are no known
compatibility issues, support may be limited.