小编Mar*_*inh的帖子

如何在makefile中的Visual Studio for C/C++中同时编译32位和64位应用程序?

我的问题类似于在同一解决方案/项目中使用Visual Studio定位32位和64位.

但是,我需要在GNUmakefile中完成此操作.

例如,如果我想通过交叉编译32位和64位应用程序gcc,我可以在编译和链接期间使用-m32&-m64flags.这个方法对于visual studio是不同的,因为我必须运行vcvarsall.bat x86编译32位和vcvarsall.bat x6464位来设置我的环境进行编译.

all: foo.exe foo64.exe

foo.exe: obj32/foo.o
    link.exe /MACHINE:X86 $(OTHER_FLAGS) /out:$@ $^

foo64.exe: obj64/foo.o
    link.exe /MACHINE:X64 $(OTHER_FLAGS) /out:$@ $^

obj32/foo.o: foo.c
    cl.exe $(CFLAGS) $(INCLUDE_DIRS) /Fo$@ /c $<

obj64/foo.o: foo.c
    cl.exe $(CFLAGS) $(INCLUDE_DIRS) /Fo$@ /c $<
Run Code Online (Sandbox Code Playgroud)

上面的示例不起作用,因为您需要在32位和64位编译之间重新运行vcvarsall.bat环境脚本.如果我在运行vcvarsall.bat x86之后尝试编译上面的示例makefile,我会在尝试链接64位可执行文件时遇到此错误:

 fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
Run Code Online (Sandbox Code Playgroud)

有没有办法通过一次make调用来完成32位和64位应用程序的构建?

gnu-make visual-studio-2010 visual-studio

7
推荐指数
1
解决办法
1万
查看次数

如何使用spring boot使用外部log4j.xml配置文件?

我创建了一个spring boot项目,并希望在我的jar中使用外部log4j.xml配置文件.我正在使用的命令行是这样的:

java -Dlog4j.debug -Dlog4j.configuration=file:/tmp/log4j.xml -jar /tmp/project.jar
Run Code Online (Sandbox Code Playgroud)

通过查看调试,看起来它实际上正确地加载了log4j.xml,但是在加载log4j.xml之后不久,它就会在spring-boot jar文件中加载log4j.properties,它会覆盖我的log4j.xml.有没有办法忽略spring-boot jar文件中的log4j.properties?

log4j: Using URL [file:/tmp/log4j.xml] for automatic log4j configuration.
log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator
log4j: System property is :null
log4j: Standard DocumentBuilderFactory search succeded.
log4j: DocumentBuilderFactory is: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
log4j: debug attribute= "null".
log4j: Ignoring debug attribute.
log4j: reset attribute= "false".
log4j: Threshold ="null".
log4j: Retreiving an instance of org.apache.log4j.Logger.
log4j: Setting [com.test] additivity to [true].
log4j: Level value for com.test is  [trace].
log4j: com.test level set to TRACE
log4j: Retreiving an …
Run Code Online (Sandbox Code Playgroud)

logging spring log4j

2
推荐指数
1
解决办法
9522
查看次数