0

In order to run my first NIF project on Windows i followed these steps:

  1. Download Hellonif -master :https://github.com/vmx/hellonif

  2. open command prompt(cmd):

    2.1 cd C:\Users\Desktop\hellonif-master =>project path

    2.2 SET PATH=C:\Program Files\C:\Program Files\erl6.4\bin => escript path

  3. added this line to rebar.config: {port_env, [{"CC", "/C:/Program Files (x86)/CodeBlocks/MinGWp/bin/mingw32-gcc"}]}.

  4. open command prompt(cmd)

    4.1 rebar compile

Unfortunately I had this error :

hellonif-master (compile)
compiling C:\Users\Desktop\hellonif-master\c_src\hello.c
La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte.

Can you please help me to resolve this problem thanks in advance

Bou6
  • 84
  • 2
  • 10

1 Answers1

0

Your CC path is invalid. Standard windows file path notation is

 "Drive:\dir\dir\file". 

Also windows accepts straight slash on the command line level, that gives you

"Drive:/dir/dir/file".

Some ported Linux applications require mingw or cygwin path format:

Mingw: "/drive/dir/dir/file"
Cygwin "/cygdrives/drive/dir/dir/file"

Your "/Drive:/dir/dir/file" is not valid.

However, you can just add your CC path to your search path list (PATH), and use standard cc or gcc file name for compiler (Mingw provides both applications as references to mingw32-gcc)

Lol4t0
  • 12,444
  • 4
  • 29
  • 65
  • Thank you Lol4t0 for your answer ,I don't undrestand the first solution what is the path that i should put in my case .for the second solution i added C:/Program Files (x86)/CodeBlocks/MinGWp/bin to the PATH but i have this error:"cl.exe is not recognized" .thanks in advance – Bou6 Apr 28 '15 at 07:02
  • try `"C:/Program Files (x86)/CodeBlocks/MinGWp/bin/gcc.exe"` or `"/C/Program Files (x86)/CodeBlocks/MinGWp/bin/gcc.exe"`. For second it want `cl` (that is MSVC compiler) unfortunately, for second you can try additionaly set `CC=gcc`. – Lol4t0 Apr 28 '15 at 07:20
  • I tried "C:/Program Files (x86)/CodeBlocks/MinGWp/bin/gcc.exe" and "/C/Program Files (x86)/CodeBlocks/MinGWp/bin/gcc.exe" but still not working i read in this link:http://stackoverflow.com/questions/15043040/compiling-project-with-nifs-with-rebar-cl-exe-not-found that i should change CFLAGS is it mandatory to change this variable ?? if so how to change this variable (i don't have Makefile in my project)and what's the value of this variable – Bou6 Apr 28 '15 at 11:32
  • You don't have to change CFLAGS if you don't want. CFLAGS are just compiler flags – Lol4t0 Apr 28 '15 at 14:14
  • when i choose the compiler as i did here, how the compiler recognize the header files erl_nif.h... isn't that the probem??? – Bou6 Apr 28 '15 at 15:09