私はWindows Vistaを使用しており、Makefileを使用してC++のファイルのフォルダーをダウンロードしました。Windows でヘッダー ファイルを含むソース ファイルをコンパイルするために、makefile を実行したいと考えています。最後に、後でMATLAB のコマンド プロンプトからこの C++ 関数を呼び出せるようにしたいので、cygwin を使用する場合、cygwin 内からのみコンパイルを実行できるため、これは不可能であると想定しています。
Windows SDK 7.1をインストールし、共通プロンプトからメイクファイルとソースがあるディレクトリに移動しnmake -f Makefile
、応答を得て、Makefile(13) : fatal error U1001: syntax error : illegal character '^' in macro Stop.
Visual Studio Express 2010 をインストールし、コマンド プロンプトから同じことを試みました。これらの関数は広く知られており、ここから使用されています - c++ ファイルをホストするページへのリンク。したがって、関数自体にエラーがあるとは思えません。
makefile を実行してこれらのファイルをコンパイルし、続いて実行するにはどうすればよいですか?
編集: これはメイクファイルです:
#!/bin/bash
CC=g++
CFLAGS= -ansi -O5 -Wall
LDFLAGS= -ansi -lm -Wall
EXEC=community convert hierarchy
OBJ1= graph_binary.o community.o
OBJ2= graph.o
all: $(EXEC)
community : $(OBJ1) main_community.o
$(CC) -o $@ $^ $(LDFLAGS)
convert : $(OBJ2) main_convert.o
$(CC) -o $@ $^ $(LDFLAGS)
hierarchy : main_hierarchy.o
$(CC) -o $@ $^ $(LDFLAGS)
##########################################
# Generic rules
##########################################
%.o: %.cpp %.h
$(CC) -o $@ -c $< $(CFLAGS)
%.o: %.cpp
$(CC) -o $@ -c $< $(CFLAGS)
clean:
rm -f *.o *~ $(EXEC)
EDIT2:GNUからmakeをインストールしました。これが出力です:これがdir
09/04/2013 17:13 <DIR> .
09/04/2013 17:13 <DIR> ..
24/09/2008 13:45 7,742 community.cpp
10/07/2008 13:41 4,386 community.h
10/07/2008 13:41 3,919 graph.cpp
10/07/2008 13:41 1,329 graph.h
10/07/2008 13:41 5,957 graph_binary.cpp
10/07/2008 13:41 3,434 graph_binary.h
23/07/2008 17:08 4,071 main_community.cpp
10/07/2008 13:41 2,110 main_convert.cpp
10/07/2008 13:41 3,449 main_hierarchy.cpp
10/07/2008 13:43 565 Makefile
23/07/2008 17:13 2,959 readme.txt
09/04/2013 17:13 <DIR> sample_networks
11 File(s) 39,921 bytes
3 Dir(s) 25,152,544,768 bytes free
そして実行make -f Makefile gives
:
g+++ -o graph_binary.o -c graph_binary.cpp -ansi -05 -Wall
process_begin: CreateProcess(NULL, g++ -o graph_binary.o -c graph_binary.cpp -ansi -05 -Wall, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [graph_binary.o] Error 2
しかし、これらのファイルはディレクトリにリストされているため、エラーが発生する理由がわかりません。