I am trying to compile a bunch of c files but for some reason compiler won't detect the header files which are located in the same exact folder. Here is the error I am getting
C:\Users\bz733p\Desktop\EBI20\source\application.c:45:25: fatal error: application.h: No such file or directory
compilation terminated.
Batch file:
set COMP_DIR=C:\Users\xxxx\Desktop\EBI20\source
set BIN_DIR=C:\Apps\opentoolsuite\runtime\msys\gcc\4.5.1-tdm-x32\bin
set CFLAGS=-g -Wall -m32
:: Clean
echo Cleaning directory...
::call clean.bat
:: Start the build
::COMPiling
echo COMPiling files....
for %%i in ("%COMP_DIR%\*.C")do %BIN_DIR%\i686-w64-mingw32-gcc-4.5.1.exe -c %CFLAGS% "%%~i" -o "%%~dpni.o" > results.txt
pause
I verified that both files are located in the same directory Files in directory. This happens for all header files in the directory. I looked into but could not find any solution
Related
My code attempts to make csc.exe reference all .dll files from the /DLLs directory.
#echo on
setlocal enableextensions enabledelayedexpansion
del Assembly.dll
cd DLLs
set "imports="
for /r %%i in ("*.dll") do set "imports=!imports!,%%i"
set "imports=%imports:~1%"
cd ..
csc.exe -nostdlib -target:library -out:Assembly.dll Loader.cs MainScript.cs -r:%imports%
However, if I have too many .dlls in the directory, the last line gives me an "input line is too long" error due to cmd.exe not being able to handle that many characters. Do you have any workarounds/solutions for this problem?
As mentioned in a comment you should use the # compiler option that links to a .rsp file where you store the compiler options including the references.
The file looks like the csc.rsp (in the same folder as csc.exe) which is part of every compilation unless the -noconfig compiler option is specified.
Example references.rsp:
-r:Microsoft.CSharp.dll
-r:System.Core.dll
-r:System.dll
-r:System.Windows.Forms.Dll
You can create the file programmatically in your batch file.
I created a very simple C dll and I'm trying to load it using Lua interactive mode
When I use require I get:
error loading module 'LuaExperiment' from file 'C:\Lua\5.2.4\LuaExperiment.dll' The specified procedure could not be found
When I use package.loadlib I get
multiple Lua VMs detected
Bellow is the contents of my Lua installation folder (LuaExperiment is my project):
I did the following to create the folder above:
Opened a Developer Command Prompt for VS2015 as an Administrator
and entered the following commands:
> vcvars32
> cl /MD /O2 /c /DLUA_BUILD_AS_DLL *.c
> ren lua.obj lua.o
> ren luac.obj luac.o
> link /DLL /IMPLIB:lua5.2.4.lib /OUT:lua5.2.4.dll *.obj
> link /OUT:lua.exe lua.o lua5.2.4.lib
> lib /OUT:lua5.2.4-static.lib *.obj
> link /OUT:luac.exe luac.o lua5.2.4-static.lib
These are the changes I made to Project Properties:
Added C:\Lua\5.2.4; to VC++ Directories->Include Directories
Changed C\C++->Advanced->Compile As to Compile as C Code (/TC)
Added C:\Lua\5.2.4\*.lib; to Linker->Additional Dependencies
Here are the .h and .c files:
https://github.com/ImperfectVoid/C
I'm trying to make a modified version of the FlySky FS-i6 firmware. After a bit of searching, I found someone who decompiled the source code here.
I'm trying to compile using arm-none-eabi, which I already have installed from the Arduino IDE.
Here's a batch file I made to compile the files, which are just a bunch of .c and .h files under several directories, but I have no clue what arguments I'm supposed to be giving the arm-none-eabi-gcc command...
#echo off
set EABI_PATH="%LocalAppData%\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\bin"
#RD /S /Q temp
mkdir temp
for /D %%d in (*) do (
echo ---- Compiling Directory: %%d
rem C Files:
for %%f in (%%d/*.c) do (
"%EABI_PATH%/arm-none-eabi-gcc" -c -mcpu=cortex-m0plus -g "%%d/%%f" -o "temp/%%~nf.o" -mthumb -g3
)
rem Header Files:
rem for %%f in (%%d/*.h) do (
rem "%EABI_PATH%/arm-none-eabi-gcc" -c -mcpu=cortex-m0plus -g "%%d/%%f" -o "temp/%%~nf.o" -mthumb -g3
rem )
)
I've searched everywhere, but I can't find any tutorials or anything about how to use the tool. All I want to do is compile the files to a firmware.hex file, you'd think it would just be a simple one-liner...
I tried building vim and gvim with MinGW according to this instruction. For convenience I'm posting them here
#echo off
REM Run this batch file from any directory to build gvim.exe and vim.exe.
REM But first edit the paths and Python version number.
REM --- Specify Vim /src folder ---
set VIMSRC=C:\Downloads\vim\src
REM --- Add MinGW /bin directory to PATH ---
PATH = C:\MinGW\bin;%PATH%
REM --- Also make sure that PYTHON, PYTHON_VER below are correct. ---
REM get location of this batch file
set WORKDIR=%~dp0
set LOGFILE=%WORKDIR%log.txt
echo Work directory: %WORKDIR%
echo Vim source directory: %VIMSRC%
REM change to Vim /src folder
cd /d %VIMSRC%
REM --- Build GUI version (gvim.exe) ---
echo Building gvim.exe ...
REM The following command will compile with both Python 2.7 and Python 3.3
mingw32-make.exe -f Make_ming.mak PYTHON="C:/Python27" PYTHON_VER=27 DYNAMIC_PYTHON=yes PYTHON3="C:/Python35" PYTHON3_VER=35 DYNAMIC_PYTHON3=yes FEATURES=HUGE GUI=yes gvim.exe > "%LOGFILE%"
REM --- Build console version (vim.exe) ---
echo Building vim.exe ...
REM The following command will compile with both Python 2.7 and Python 3.3
mingw32-make.exe -f Make_ming.mak PYTHON="C:/Python27" PYTHON_VER=27 DYNAMIC_PYTHON=yes PYTHON3="C:/Python35" PYTHON3_VER=35 DYNAMIC_PYTHON3=yes FEATURES=HUGE GUI=no vim.exe >> "%LOGFILE%"
echo Moving files ...
move gvim.exe "%WORKDIR%"
move vim.exe "%WORKDIR%"
echo Cleaning Vim source directory ...
REM NOTE: "mingw32-make.exe -f Make_ming.mak clean" does not finish the job
IF NOT %CD%==%VIMSRC% GOTO THEEND
IF NOT EXIST vim.h GOTO THEEND
IF EXIST pathdef.c DEL pathdef.c
IF EXIST obj\NUL RMDIR /S /Q obj
IF EXIST obji386\NUL RMDIR /S /Q obji386
IF EXIST gobj\NUL RMDIR /S /Q gobj
IF EXIST gobji386\NUL RMDIR /S /Q gobji386
IF EXIST gvim.exe DEL gvim.exe
IF EXIST vim.exe DEL vim.exe
:THEEND
pause
I'm getting the following error during a build process:
Building gvim.exe ...
diff.c: In function 'ex_diffpatch':
diff.c:891:12: error: storage size of 'st' isn't known
stat_T st;
^
diff.c:891:12: warning: unused variable 'st' [-Wunused-variable]
mingw32-make.exe: *** [gobjx86-64/diff.o] Error 1
Building vim.exe ...
diff.c: In function 'ex_diffpatch':
diff.c:891:12: error: storage size of 'st' isn't known
stat_T st;
^
diff.c:891:12: warning: unused variable 'st' [-Wunused-variable]
mingw32-make.exe: *** [objx86-64/diff.o] Error 1
Does anyone know what could be the problem?
I figured out what was the problem. I was using a 32 bit MinGW instead of the one for 64 bit system. In other words I needed to download MinGW-w64 from https://mingw-w64.org/doku.php instead of downloading MinGW from http://www.mingw.org/.
I don't know what this problem is; but if I were you I would follow the instructions by Antoine Mechelynck, which are very detailed. I've used his guide for building at Unix/Linux guide and they are very good.
You could consider downloading the binary from vim.org if you still have problems to build it. There is also a portable version (from PortableApps), which doesn't requires privileges to install and even run from USB stick.
I am trying to write my first bat file. Sorry......
I need to input a source directory (dir) for another bat file to find test files and a destination directory (log) for the bat file to output its results.
The bat file that does the processing is called fits.bat.
-i Indicates that a file or directory to process will follow
-o Directs the FITS output to a file
I have this:
#echo off
cd c:\program files\fits\fits-0.8.0
SET /P dir=enter directory of source files
SET /P log=enter directory for log files
fits.bat -i %dir -o %log
pause
But I get no output at all.
If I type individual commands in command prompt window , it works and files in dir folder are correctly read and output is sent to the log folder
try this....
#echo off
cd c:\program files\fits\fits-0.8.0
set /p dir=enter directory of source files
set /p log=echo enter directory for log files
fits.bat -i %dir% -o %log%
pause
when you call variables you need a % in front and back
%VAR%
You need to surround your two variables in percent signs:
#echo off
cd c:\program files\fits\fits-0.8.0
SET /P dir=enter directory of source files:
SET /P log=enter directory for log files:
fits.bat -i %dir% -o %log%
pause