2014-10-19 259 views
0

當使用這個turotial:http://visualgdb.com/tutorials/raspberry/crosscompiler/VisualGDB和Raspberry Pi

我建在Visual Studio 2012的解決方案,我得到這個輸出:

1>------ Build started: Project: LinuxHelloWorld, Configuration: Debug Win32 ------ 
1> VisualGDB: Attempting inline build... 
1> VisualGDB: Run "cmd.exe /c "C:\SysGCC\raspberry\bin\make.exe" CONFIG=Debug" in directory "C:\Users\Kels\LinuxHelloWorld\LinuxHelloWorld" on local computer 
1> make: *** No targets specified and no makefile found. Stop. 
1> ------------------------------------------------------------- 
1> Command exited with code 2 
1> Executable: cmd.exe 
1> Arguments: /c "C:\SysGCC\raspberry\bin\make.exe" CONFIG=Debug 
1> Directory: C:\Users\Kels\LinuxHelloWorld\LinuxHelloWorld 
1>VisualGDB : error : Command-line action failed 
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""C:\Program Files (x86)\Sysprogs\VisualGDB\VisualGDB.exe" /build "C:\Users\Kels\LinuxHelloWorld\LinuxHelloWorld\LinuxHelloWorld.vcxproj" "/solution:C:\Users\Kels\LinuxHelloWorld\LinuxHelloWorld.sln" "/config:Debug" "/platform:Win32"" exited with code 1. 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

我什麼,下一步將是命令行失敗困惑。 提前致謝!

新增10/20。 Makefile文件在C:\用戶\ Kels \ LinuxHelloWorld \ LinuxHelloWorld

#Generated by VisualGDB project wizard. 
#Note: VisualGDB will automatically update this file when you add new sources to the project. 
#All other changes you make in this file will be preserved. 
#Visit http://visualgdb.com/makefiles for more details 

#VisualGDB: AutoSourceFiles  #<--- remove this line to disable auto-updating of SOURCEFILES and EXTERNAL_LIBS 

TARGETNAME := LinuxHelloWorld 
#TARGETTYPE can be APP, STATIC or SHARED 
TARGETTYPE := APP 

to_lowercase = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1)))))))))))))))))))))))))) 

CONFIG ?= DEBUG 

CONFIGURATION_FLAGS_FILE := $(call to_lowercase,$(CONFIG)).mak 

    include $(CONFIGURATION_FLAGS_FILE) 
include $(ADDITIONAL_MAKE_FILES) 

ifeq ($(BINARYDIR),) 
error: 
    $(error Invalid configuration, please check your inputs) 
endif 

SOURCEFILES := LinuxHelloWorld.cpp 
EXTERNAL_LIBS := 
EXTERNAL_LIBS_COPIED := $(foreach lib, $(EXTERNAL_LIBS),$(BINARYDIR)/$(notdir $(lib))) 

CFLAGS += $(COMMONFLAGS) 
CXXFLAGS += $(COMMONFLAGS) 
ASFLAGS += $(COMMONFLAGS) 
LDFLAGS += $(COMMONFLAGS) 

CFLAGS += $(addprefix -I,$(INCLUDE_DIRS)) 
CXXFLAGS += $(addprefix -I,$(INCLUDE_DIRS)) 

CFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS)) 
CXXFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS)) 
ASFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS)) 

CXXFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS)) 
CFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS)) 
LDFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS)) 

LDFLAGS += $(addprefix -L,$(LIBRARY_DIRS)) 

ifeq ($(GENERATE_MAP_FILE),1) 
LDFLAGS += -Wl,-Map=$(BINARYDIR)/$(basename $(TARGETNAME)).map 
endif 

LIBRARY_LDFLAGS = $(addprefix -l,$(LIBRARY_NAMES)) 

ifeq ($(IS_LINUX_PROJECT),1) 
    RPATH_PREFIX := -Wl,--rpath='$$ORIGIN/../ 
    LIBRARY_LDFLAGS += $(EXTERNAL_LIBS) 
    LIBRARY_LDFLAGS += -Wl,--rpath='$$ORIGIN' 
    LIBRARY_LDFLAGS += $(addsuffix ',$(addprefix $(RPATH_PREFIX),$(dir $(EXTERNAL_LIBS)))) 

    ifeq ($(TARGETTYPE),SHARED) 
     CFLAGS += -fPIC 
     CXXFLAGS += -fPIC 
     ASFLAGS += -fPIC 
     LIBRARY_LDFLAGS += -Wl,-soname,$(TARGETNAME) 
    endif 

    ifneq ($(LINUX_PACKAGES),) 
     PACKAGE_CFLAGS := $(foreach pkg,$(LINUX_PACKAGES),$(shell pkg-config --cflags $(pkg))) 
     PACKAGE_LDFLAGS := $(foreach pkg,$(LINUX_PACKAGES),$(shell pkg-config --libs $(pkg))) 
     CFLAGS += $(PACKAGE_CFLAGS) 
     CXXFLAGS += $(PACKAGE_CFLAGS) 
     LIBRARY_LDFLAGS += $(PACKAGE_LDFLAGS) 
    endif 
else 
    LIBRARY_LDFLAGS += $(EXTERNAL_LIBS) 
endif 

LIBRARY_LDFLAGS += $(ADDITIONAL_LINKER_INPUTS) 

all_make_files := $(firstword $(MAKEFILE_LIST)) $(CONFIGURATION_FLAGS_FILE) $(ADDITIONAL_MAKE_FILES) 

ifeq ($(STARTUPFILES),) 
    all_source_files := $(SOURCEFILES) 
else 
    all_source_files := $(STARTUPFILES) $(filter-out $(STARTUPFILES),$(SOURCEFILES)) 
endif 

source_obj1 := $(all_source_files:.cpp=.o) 
source_obj2 := $(source_obj1:.c=.o) 
source_obj3 := $(source_obj2:.s=.o) 
source_obj4 := $(source_obj3:.S=.o) 
source_obj5 := $(source_obj4:.cc=.o) 
source_objs := $(source_obj5:.cxx=.o) 

all_objs := $(addprefix $(BINARYDIR)/, $(notdir $(source_objs))) 

PRIMARY_OUTPUTS := 

ifeq ($(GENERATE_BIN_FILE),1) 
PRIMARY_OUTPUTS += $(BINARYDIR)/$(basename $(TARGETNAME)).bin 
endif 

ifeq ($(GENERATE_IHEX_FILE),1) 
PRIMARY_OUTPUTS += $(BINARYDIR)/$(basename $(TARGETNAME)).ihex 
endif 

ifeq ($(PRIMARY_OUTPUTS),) 
PRIMARY_OUTPUTS := $(BINARYDIR)/$(TARGETNAME) 
endif 

all: $(PRIMARY_OUTPUTS) 

$(BINARYDIR)/$(basename $(TARGETNAME)).bin: $(BINARYDIR)/$(TARGETNAME) 
    $(OBJCOPY) -O binary $< [email protected] 

$(BINARYDIR)/$(basename $(TARGETNAME)).ihex: $(BINARYDIR)/$(TARGETNAME) 
    $(OBJCOPY) -O ihex $< [email protected] 

ifeq ($(TARGETTYPE),APP) 
$(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS) 
    $(LD) -o [email protected] $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP) 
endif 

ifeq ($(TARGETTYPE),SHARED) 
$(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS) 
    $(LD) -shared -o [email protected] $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP) 
endif 

ifeq ($(TARGETTYPE),STATIC) 
$(BINARYDIR)/$(TARGETNAME): $(all_objs) 
    $(AR) -r [email protected] $^ 
endif 

-include $(all_objs:.o=.dep) 

clean: 
ifeq ($(USE_DEL_TO_CLEAN),1) 
    del /S /Q $(BINARYDIR) 
else 
    rm -rf $(BINARYDIR) 
endif 

$(BINARYDIR): 
    mkdir $(BINARYDIR) 

#VisualGDB: FileSpecificTemplates  #<--- VisualGDB will use the following lines to define rules for source files in subdirectories 
$(BINARYDIR)/%.o : %.cpp $(all_make_files) |$(BINARYDIR) 
    $(CXX) $(CXXFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

$(BINARYDIR)/%.o : %.c $(all_make_files) |$(BINARYDIR) 
    $(CC) $(CFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

$(BINARYDIR)/%.o : %.S $(all_make_files) |$(BINARYDIR) 
    $(CC) $(CFLAGS) $(ASFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

$(BINARYDIR)/%.o : %.s $(all_make_files) |$(BINARYDIR) 
    $(CC) $(CFLAGS) $(ASFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

$(BINARYDIR)/%.o : %.cc $(all_make_files) |$(BINARYDIR) 
    $(CC) $(CFLAGS) $(CXXFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

$(BINARYDIR)/%.o : %.cxx $(all_make_files) |$(BINARYDIR) 
    $(CC) $(CFLAGS) $(CXXFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

#VisualGDB: GeneratedRules 

     #<--- All lines below are auto-generated 
+0

make:***沒有指定目標,也沒有找到makefile。停止。 – 2014-10-19 22:06:28

+0

好的,那麼我該如何解決這個問題。 我進入了C:\ SysGCC \ raspberry \ bin \並且有一個make.exe。但是當我從命令行運行它時,出現以下錯誤:make:***沒有指定目標,也沒有找到makefile。停止。 – Kelsey 2014-10-19 22:08:37

+0

實際上,最有可能幫助你的人是微軟和開放源代碼這個相當奇怪的組合,它們是你所遵循的教程的創建者。 – 2014-10-19 22:17:32

回答

0
我還使用VisualGDB爲樹莓派的發展,我見過最大的插件之一

。從你的日誌看來,你似乎正在使用交叉編譯工具鏈進行構建。 你可以做的第一件事是去C:\Users\Kels\LinuxHelloWorld\LinuxHelloWorld並驗證那裏是否存在Makefile並檢查內容(甚至可能將它們添加到問題中,以便它們可以被期望)。另一種選擇是在Pi上自己設置編譯,而不是使用工具鏈(這可以通過項目嚮導來完成) - 由於Pi無法與PC進行比較,所以它會變慢,但是再次,任何第三方庫你可能需要(很可能你會)可以很容易地通過apt-get安裝在Pi上,並且只是在你使用工具鏈時必須在你的PC上交叉編譯它們的時候使用。

UPDATE

繼承人是我的樣本項目的一個例子的Makefile:

#Generated by VisualGDB project wizard. 
#Note: VisualGDB will automatically update this file when you add new sources to the project. 
#All other changes you make in this file will be preserved. 
#Visit http://visualgdb.com/makefiles for more details 

#VisualGDB: AutoSourceFiles  #<--- remove this line to disable auto-updating of SOURCEFILES and EXTERNAL_LIBS 

TARGETNAME := RpiOmxTunnelReconfiguration 
#TARGETTYPE can be APP, STATIC or SHARED 
TARGETTYPE := APP 

to_lowercase = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1)))))))))))))))))))))))))) 

CONFIG ?= DEBUG 

CONFIGURATION_FLAGS_FILE := $(call to_lowercase,$(CONFIG)).mak 

include $(CONFIGURATION_FLAGS_FILE) 
include $(ADDITIONAL_MAKE_FILES) 

ifeq ($(BINARYDIR),) 
error: 
    $(error Invalid configuration, please check your inputs) 
endif 

SOURCEFILES := Omx/Component.cpp Omx/ComponentPort.cpp RpiOmxTunnelReconfiguration.cpp 
EXTERNAL_LIBS := 
EXTERNAL_LIBS_COPIED := $(foreach lib, $(EXTERNAL_LIBS),$(BINARYDIR)/$(notdir $(lib))) 

CFLAGS += $(COMMONFLAGS) 
CXXFLAGS += $(COMMONFLAGS) 
ASFLAGS += $(COMMONFLAGS) 
LDFLAGS += $(COMMONFLAGS) 

CFLAGS += $(addprefix -I,$(INCLUDE_DIRS)) 
CXXFLAGS += $(addprefix -I,$(INCLUDE_DIRS)) 

CFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS)) 
CXXFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS)) 
ASFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS)) 

CXXFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS)) 
CFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS)) 
LDFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS)) 

LDFLAGS += $(addprefix -L,$(LIBRARY_DIRS)) 

LIBRARY_LDFLAGS = $(addprefix -l,$(LIBRARY_NAMES)) 

ifeq ($(IS_LINUX_PROJECT),1) 
    RPATH_PREFIX := -Wl,--rpath='$$ORIGIN/../ 
    LIBRARY_LDFLAGS += $(EXTERNAL_LIBS) 
    LIBRARY_LDFLAGS += -Wl,--rpath='$$ORIGIN' 
    LIBRARY_LDFLAGS += $(addsuffix ',$(addprefix $(RPATH_PREFIX),$(dir $(EXTERNAL_LIBS)))) 

    ifeq ($(TARGETTYPE),SHARED) 
     LIBRARY_LDFLAGS += -Wl,-soname,$(TARGETNAME) 
    endif 

else 
    LIBRARY_LDFLAGS += $(EXTERNAL_LIBS) 
endif 

LIBRARY_LDFLAGS += $(ADDITIONAL_LINKER_INPUTS) 

all_make_files := Makefile $(CONFIGURATION_FLAGS_FILE) $(ADDITIONAL_MAKE_FILES) 

ifeq ($(STARTUPFILES),) 
    all_source_files := $(SOURCEFILES) 
else 
    all_source_files := $(STARTUPFILES) $(filter-out $(STARTUPFILES),$(SOURCEFILES)) 
endif 

source_obj1 := $(all_source_files:.cpp=.o) 
source_obj2 := $(source_obj1:.c=.o) 
source_obj3 := $(source_obj2:.s=.o) 
source_objs := $(source_obj3:.S=.o) 

all_objs := $(addprefix $(BINARYDIR)/, $(notdir $(source_objs))) 

ifeq ($(GENERATE_BIN_FILE),1) 
all: $(BINARYDIR)/$(basename $(TARGETNAME)).bin 

$(BINARYDIR)/$(basename $(TARGETNAME)).bin: $(BINARYDIR)/$(TARGETNAME) 
    $(OBJCOPY) -O binary $< [email protected] 

else 
all: $(BINARYDIR)/$(TARGETNAME) 
endif 

ifeq ($(TARGETTYPE),APP) 
$(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS) 
    $(LD) -o [email protected] $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP) 
endif 

ifeq ($(TARGETTYPE),SHARED) 
$(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS) 
    $(LD) -shared -o [email protected] $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP) 
endif 

ifeq ($(TARGETTYPE),STATIC) 
$(BINARYDIR)/$(TARGETNAME): $(all_objs) 
    $(AR) -r [email protected] $^ 
endif 

-include $(all_objs:.o=.dep) 

clean: 
ifeq ($(USE_DEL_TO_CLEAN),1) 
    del /S /Q $(BINARYDIR) 
else 
    rm -rf $(BINARYDIR) 
endif 

$(BINARYDIR): 
    mkdir $(BINARYDIR) 

#VisualGDB: FileSpecificTemplates  #<--- VisualGDB will use the following lines to define rules for source files in subdirectories 
$(BINARYDIR)/%.o : %.cpp $(all_make_files) |$(BINARYDIR) 
    $(CXX) $(CXXFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

$(BINARYDIR)/%.o : %.c $(all_make_files) |$(BINARYDIR) 
    $(CC) $(CFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

$(BINARYDIR)/%.o : %.S $(all_make_files) |$(BINARYDIR) 
    $(CC) $(CFLAGS) $(ASFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

$(BINARYDIR)/%.o : %.s $(all_make_files) |$(BINARYDIR) 
    $(CC) $(CFLAGS) $(ASFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

#VisualGDB: GeneratedRules    #<--- All lines below are auto-generated 


$(BINARYDIR)/Component.o : Omx/Component.cpp $(all_make_files) |$(BINARYDIR) 
    $(CXX) $(CXXFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 


$(BINARYDIR)/ComponentPort.o : Omx/ComponentPort.cpp $(all_make_files) |$(BINARYDIR) 
    $(CXX) $(CXXFLAGS) -c $< -o [email protected] -MD -MF $(@:.o=.dep) 

正如你在這裏看到的TARGETNAME := RpiOmxTunnelReconfiguration

ifeq ($(GENERATE_BIN_FILE),1) 
all: $(BINARYDIR)/$(basename $(TARGETNAME)).bin 

$(BINARYDIR)/$(basename $(TARGETNAME)).bin: $(BINARYDIR)/$(TARGETNAME) 
    $(OBJCOPY) -O binary $< [email protected] 

else 
all: $(BINARYDIR)/$(TARGETNAME) 
endif 

將始終定義輸出二進制文件。也許重新創建項目。

+0

我能夠在文件夾中找到Makefile。我將它添加到上面的問題。你會建議在工具鏈上設置彙編嗎?這是我第一次使用Pi,因此我正在學習。謝謝! – Kelsey 2014-10-20 14:30:11

+0

如果項目很小,並且不需要大量的時間來編譯,我認爲直接在Pi上執行編譯是有意義的。 – 2014-10-20 21:16:18

+0

至於make文件 - 它看起來有點奇怪,'PRIMARY_OUTPUTS'可能最終爲空,然後target'all'將沒有依賴關係,請檢查項目設置。我看了一下我的一個示例項目,並在那裏定義了輸出文件,因此可能是項目設置完全錯誤。 – 2014-10-20 21:19:52