I compliation the code with Vscode.
The clang -v:
clang version 14.0.3
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/mingw64/bin
You can see I get clang form msys.
The file I compliate use such header file:
#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
#include <d2d1.h>
The task I use :
"args": [
"-fdiagnostics-color=always",
"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22000.0\\um\\x86\\user32.lib",
"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22000.0\\um\\x86\\ole32.lib",
"C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.22000.0\\um\\x86\\d2d1.lib",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-mwindows"
],
And the complier messages :
C:\msys64\mingw64\bin\clang-cpp.exe -fdiagnostics-color=always "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\user32.lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\ole32.lib" "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\d2d1.lib" -g C:\Users\cookie\Desktop\GameEngineFromScratch\Platform\Windows\helloengine_d2d.cpp -o C:\Users\cookie\Desktop\GameEngineFromScratch\Platform\Windows\helloengine_d2d.exe -mwindows
clang-cpp: warning: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\user32.lib: 'linker' input unused in cpp mode [-Wunused-command-line-argument]
clang-cpp: warning: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\ole32.lib: 'linker' input unused in cpp mode [-Wunused-command-line-argument]
clang-cpp: warning: C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22000.0\um\x86\d2d1.lib: 'linker' input unused in cpp mode [-Wunused-command-line-argument]
clang-cpp: warning: argument unused during compilation: '-mwindows' [-Wunused-command-line-argument]
I got a executable file but when I run it my terminal give me an erro message Unable to run: The specified executable is not a valid application for this operating system platform
It look like I got a executable file for linux but not windows.How to solve this question.
clang-cpp is the Clang preprocessor, not the C++ compiler. You should use clang++ for the C++ compiler front-end program.
I am using Sublime Text and learning C++. I installed Mingw (also added path) and Sublime Text and added a new build system for taking the external output and input.
Here is the code:
{
"cmd" : ["g++ -std=c++14 '$file_name' -o '$file_base_name' && timeout 4s ./'$file_base_name'<input.txt>output.txt"],
"selector" : "source.c, source.cpp",
"shell": true,
"working_dir" : "$file_path"
}
After pressing Control+B, it threw an error:
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:D:\Anand\competitive programming\input.txt: file format not recognized; treating as linker script
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:D:\Anand\competitive programming\input.txt:1: syntax error
collect2.exe: error: ld returned 1 exit status
[Finished in 0.1s with exit code 1]
[shell_cmd: g++ "D:\Anand\competitive programming\input.txt" -o "D:\Anand\competitive programming/input" && "D:\Anand\competitive programming/input"]
[dir: D:\Anand\competitive programming]
[path: C:\MinGW\bin;C:\Program Files\Java\jdk-12.0.2\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\MinGW\bin]
Error 2:
The system cannot find the path specified.
[Finished in 0.0s with exit code 1]
[cmd: ["g++ -std=c++14 'HelloWorld.cpp' -o 'HelloWorld' && timeout 4s ./'HelloWorld'<input.txt>output.txt"]]
[dir: D:\Anand\competitive programming]
[path: C:\MinGW\bin;C:\Program Files\Java\jdk-12.0.2\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\MinGW\bin]
You don't need the single quotes surrounding the $ variables, and you don't need the ./, as you're running Windows. Edit your build system to include the following:
"cmd" : ["g++ -std=c++14 $file_name -o $file_base_name && timeout 4s $file_base_name < input.txt > output.txt"],
and you should be all set.
I'm currently using the following steps but I'm having trouble compiling:
Add 64bit/32bit NASM to path: C:\Program Files\NASM for 64 bit
//On 32 bit simply switch to x86 native tool
Open native command prompt for VS2015 x64
or run "C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\bin\amd64\vcvars64.bat"
== Environment variables that need to be set ==
Set FPSDIR=C:\Dev\OpenSSL\x64\openssl-fips-ecp-2.0.16
Set PROCESSOR_ARCHITECTURE=AMD64
== Building Fips compliant module ==
cd openssl-fips-ecp-2.0.16
xcopy inc32\* include\* /O /X /E /H /K
=========
Open ms\do_fips.bat and remove "dll"
[Optional] add "debug" to same line
Open util\mk1mf.pl and add "libcmt.lib LIBCPMT.LIB libcmtd.lib LIBCPMTD.LIB" to EX_LIBS (Line 650 typically)
=========
ms\do_fips
mkdir lib
copy out32.dbg\* lib\*
mkdir bin
copy util\* bin\*
copy out32.dbg\fips_standalone_sha1.exe bin
== Building ==
cd openssl-1.0.2l
======
Open util\pl\VC-32.pl
remove "|| $fips " from line 48 and 133
[Optional]Open ms\do_win64a.bat and add "debug" to line 15 right before VC-WIN64A
======
perl Configure VC-WIN64A fips no-ec2m no-shared -DUNICODE -DOPENSSL_THREADS --with-fipsdir=C:\Dev\OpenSSL\x64\openssl-fips-ecp-2.0.16
ms\do_win64a
nmake -f ms\nt.mak clean
nmake -f ms\ntdll.mak clean
nmake -f ms\nt.mak
//On 32 bit be sure to do 32bit dir and
//Configure VC-WIN32
//ms\do_nasm (add debug here too)
Compiler is failing:
DOPENSSL_THREADS -DDSO_WIN32 -DOPENSSL_FIPS -DOPENSSL_NO_ERR -DUNICODE -DOPENSSL_THREADS -W3 -Gs0 -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -IC:\Dev\OpenSSL\x64\openssl-fips-ecp-2.0.16/include -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_SSL2 -DOPENSSL_NO_KRB5 -DOPENSSL_FIPS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_WEAK_SSL_CIPHERS -DOPENSSL_NO_DYNAMIC_ENGINE /Zl /Zi /Fdtmp32/lib -c .\crypto\rand\rand_lib.c
rand_lib.c
.\crypto\rand\rand_lib.c(191): error C2143: syntax error: missing ')' before '*'
.\crypto\rand\rand_lib.c(191): error C2143: syntax error: missing '{' before '*'
.\crypto\rand\rand_lib.c(191): error C2059: syntax error: 'type'
.\crypto\rand\rand_lib.c(192): error C2059: syntax error: ')'
I looked at the code and it seems that it doesn't know what
DRBG_CTX
I searched and it should be included from FIPS directory, but it isn't, what is wrong with my build steps?
Found it, it seems by default the "include" directory is filled with 0kb files for some reason, I overwrited with the 32 bit include (inc32) directory's contents in the FIPS folder to the "include" one, and it seems to have solved the issue.
In case someone is wondering how to build it and pass the fips self-test.
Add 64bit/32bit NASM to path: C:\Program Files\NASM for 64 bit
//On 32 bit simply switch to x86 native tool and Set PROCESSOR_ARCHITECTURE=x86
Open native command prompt for VS2015 x64
or run "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
== Environment variables that need to be set ==
Set FPSDIR=C:\Dev\OpenSSL\x64\openssl-fips-ecp-2.0.16
Set PROCESSOR_ARCHITECTURE=AMD64
== Building Fips compliant module ==
cd openssl-fips-ecp-2.0.16
Open util\mk1mf.pl and add
$cflags.= " -DOPENSSL_FIPS_DEBUGGER";
after line 311
This will disable the fingerprint check for the module, whose purpose is to ensure that the source code hasn't been modified(but leave all other tests intact).
This is done because the fingerprint check appears to be broken for static libraries.
ms\do_fips
mkdir lib
copy out32dll\* lib\*
mkdir bin
copy util\* bin\*
copy out32dll\fips_standalone_sha1.exe bin
xcopy inc32\* include\* /O /X /E /H /K
== Building ==
cd openssl-1.0.2l
perl Configure VC-WIN64A fips no-ec2m no-shared -DUNICODE -DOPENSSL_FIPS_DEBUGGER -DOPENSSL_THREADS --with-fipsdir=C:\Dev\OpenSSL\openssl-fips-ecp-2.0.16
ms\do_win64a
nmake -f ms\nt.mak clean
nmake -f ms\ntdll.mak clean
nmake -f ms\nt.mak
//On 32 bit be sure to do 32bit dir and
//Configure VC-WIN32 ms\do_nasm
I wanted to build and run Pascal in Sublime Text 2 (or 3). I've searched as much as I could and although I could get sublime to BUILD my dpr or pas files in ST3, I struggle with getting them to run as an exe in command prompt. Therefore, I tried using this, as someone suggested (Qwerty answered this question on someone else's post):
{
"cmd": ["fpc", "${file_path}/${file_base_name}"],
"selector": "source.pascal",
"variants": [
{
"cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"],
"name": "Run",
"shell": true
}
]
}
It works perfectly fine when compiling and running hello world, but gives me errors with everything else:
Free Pascal Compiler version 2.6.4 [2014/03/06] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling F:\Ali\Pascal\Projects\adult.pas
Linking F:\Ali\Pascal\Projects\adult.exe
adult.pas(32,1) Error: Can't create object file: F:\Ali\Pascal\Projects\adult.exe
adult.pas(32,1) Fatal: Can't create executable F:\Ali\Pascal\Projects\adult.exe
Fatal: Compilation aborted
Error: C:\FPC\2.6.4\bin\i386-Win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled)
[Finished in 0.4s with exit code 1]
Whereas if it's Hello World:
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling F:\Ali\Pascal\Projects\hello.pas
Linking F:\Ali\Pascal\Projects\hello.exe
4 lines compiled, 0.3 sec , 25936 bytes code, 1644 bytes data
[Finished in 0.5s]
This build system compiles your program AND runs it automagically. Although if you just want to compile or you only want to run the program you can do it by pressing Ctrl-Shift-B.
{
"shell": true,
"cmd": ["fpc", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "$file_base_name.exe", "&", "pause"],
"selector": "source.pascal",
"variants": [
{
"cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"],
"name": "Run",
"shell": true
},
{
"cmd": ["fpc", "${file_path}/${file_base_name}"],
"name": "Compile",
"shell": true
}
]
}
Check your processes. The exe that was built before is still running and locked by OS so that the fpc can't overwrite it. Hello was probably not running, so it was ok.
Everything else worked here.
My variant:
{
"cmd": ["C:\\lazarus\\fpc\\2.6.4\\bin\\i386-win32\\fpc.exe", "$file"],
"selector": "source.pascal",
"variants": [{
"cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"],
"name": "Run",
"shell": true
}]
}
PS! I didn't know you could do that. I like Sublime now even more ! Thanks.
Environment: macOS Catalina, Sublime Text 3.
You should uninstall Free Pascal if you installed it with * .dmg
You can find detailed instruction here: https://wiki.freepascal.org/Uninstalling_Lazarus_on_macOS
Install Free Pascal via Brew:
$ brew install fpc
In Sublime create build system for Pascal language:
[Tools] -> [Build System] -> [New Build System...] and replace default code with code below:
{
"shell_cmd": "fpc \"${file}\" -o\"${file_path}/${file_base_name}\" && open -a Terminal.app \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.pascal",
"variants":
[
{
"name": "Compile Only",
"shell_cmd": "fpc \"${file}\" -o\"${file_path}/${file_base_name}\"",
"shell":true
},
]
}
When you press Cmd-B it automatically compiles AND runs your program. Shift-Cmd-B displays two options "Pascal" (compile & run) and "Pascal - Compile Only".
Answer is based on:
https://gist.github.com/dominik-hadl/6c24b3836c435dacb674
I've just installed Qt SDK 1.2.1 on my PC. I created a new project as a test:
File > New File or Project... > Other Project > Plain C++ Project
I chose these build settings:
Qt Creator generated this .pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
and this main.cpp file:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
The build fails:
13:39:35: Running build steps for project test...
13:39:35: Starting: "C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe" clean
Could Not Find C:\Dev\Projects\Qt\test\debug\main.obj
del debug\main.obj
del debug\test.intermediate.manifest debug\test.exp debug\test.ilk vc*.pdb vc*.idb
Could Not Find C:\Dev\Projects\Qt\test\debug\test.intermediate.manifest
Could Not Find C:\Dev\Projects\Qt\test\vc*.pdb
Could Not Find C:\Dev\Projects\Qt\test\test.intermediate.manifest
Could Not Find C:\Dev\Projects\Qt\test\test.exp
Could Not Find C:\Dev\Projects\Qt\test\test.ilk
Could Not Find C:\Dev\Projects\Qt\test\vc*.pdb
c:\dev\qt\qtsdk\desktop\qt\4.8.1\msvc2008\bin\qmake.exe -spec ..\..\..\Qt\QtSDK\Desktop\Qt\4.8.1\msvc2008\mkspecs\win32-msvc2008 CONFIG+=declarative_debug -o Makefile test.pro
C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug clean
C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe -f Makefile.Release clean
Could Not Find C:\Dev\Projects\Qt\test\release\main.obj
Could Not Find C:\Dev\Projects\Qt\test\release\test.intermediate.manifest
del release\main.obj
del release\test.intermediate.manifest release\test.exp
del ".\test.intermediate.manifest"
del test.exp
del test.ilk
del vc*.pdb
del vc*.idb
Could Not Find C:\Dev\Projects\Qt\test\vc*.idb
jom 1.0.8 - empower your cores
13:39:36: The process "C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe" exited normally.
13:39:36: Configuration unchanged, skipping qmake step.
13:39:36: Starting: "C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe"
cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -I"..\..\..\Qt\QtSDK\Desktop\Qt\4.8.1\msvc2008\mkspecs\win32-msvc2008" -Fodebug\ #C:\DOCUME~1\Mitch!\LOCALS~1\Temp\main.obj.5936.16.jom
C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug
'cl' is not recognized as an internal or external command,
operable program or batch file.
jom: C:\Dev\Projects\Qt\test\Makefile.Debug [debug\main.obj] Error 1
jom 1.0.8 - empower your cores
jom: C:\Dev\Projects\Qt\test\Makefile [debug] Error 2
13:39:36: The process "C:\Dev\Qt\QtSDK\QtCreator\bin\jom.exe" exited with code 2.
Error while building project test (target: Desktop)
When executing build step 'Make'
I've tried running the Qt 4.8.1 for Desktop (MSVC 2008) batch script before starting Qt Creator and checking the Projects > Build Settings > Build Environment > Using System Environment > Clear System Environment without success.
My PATH variable after installing Qt SDK 1.2.1:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\jEdit;C:\Program Files\TortoiseSVN\bin;C:\Program Files\doxygen\bin;C:\Program Files\NVIDIA Corporation\Cg\bin;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\WINDOWS\system32\WindowsPowerShell\v1.0
My computer is running Windows XP Professional (Service Pack 2). The version of Qt Creator that ships with Qt SDK 1.2.1 is 2.4.1.
Looks like cl is either not installed on your system, or needs to be added to the PATH environment variable. Try to find the cl.exe binary somewhere in C:\Program Files\Microsoft Visual Studio [version]\ and add the directory that contains that binary to your PATH.