【问题标题】:Microsoft Visual Studio 2010 Compile for MIPSMicrosoft Visual Studio 2010 为 MIPS 编译
【发布时间】:2014-03-01 13:26:59
【问题描述】:

我想弄清楚如何在 Visual Studio 中编译一个简单的 hello world,但要使用 MIPS 处理器。遵循 MS website 上发布的指南。唯一的区别是我在 Visual Studio 2010 上尝试这个:

#include <iostream>

int main()
{
    std::cout << "This is a native C++ program." << std::endl;
    return 0;
}

尝试使用 /QMR4100 选项进行编译:

c:\Users\ukhan\Documents\Auto_Security\Test_Code>cl  /QMR4100 /EHsc forloop.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

**cl : Command line warning D9002 : ignoring unknown option '/QMR4100'**
forloop.cpp
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:forloop.exe
forloop.obj

所以,我检查了选项的帮助,但似乎命令行选项无效:

c:\Users\ukhan\Documents\Auto_Security\Test_Code>cl /?
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

                         C/C++ COMPILER OPTIONS


                              -OPTIMIZATION-

/O1 minimize space                      /O2 maximize speed
/Ob<n> inline expansion (default n=0)   /Od disable optimizations (default)
/Og enable global optimization          /Oi[-] enable intrinsic functions
/Os favor code space                    /Ot favor code speed
/Ox maximum optimizations
/favor:<blend|AMD64|INTEL64> select processor to optimize for, one of:
    blend - a combination of optimizations for several different x64 processors
    AMD64 - 64-bit AMD processors
    INTEL64 - Intel(R)64 architecture processors

                             -CODE GENERATION-

/GF enable read-only string pooling     /Gm[-] enable minimal rebuild
/Gy[-] separate functions for linker    /GS[-] enable security checks
/GR[-] enable C++ RTTI                  /GX[-] enable C++ EH (same as /EHsc)
/EHs enable C++ EH (no SEH exceptions)  /EHa enable C++ EH (w/ SEH exceptions)
/EHc extern "C" defaults to nothrow
/fp:<except[-]|fast|precise|strict> choose floating-point model:
    except[-] - consider floating-point exceptions when generating code
    fast - "fast" floating-point model; results are less predictable
    precise - "precise" floating-point model; results are predictable
    strict - "strict" floating-point model (implies /fp:except)
/Qfast_transcendentals generate inline FP intrinsics even with /fp:except
/GL[-] enable link-time code generation /GA optimize for Windows Application
/Ge force stack checking for all funcs  /Gs[num] control stack checking calls
/Gh enable _penter function call        /GH enable _pexit function call
/GT generate fiber-safe TLS accesses    /RTC1 Enable fast checks (/RTCsu)
/RTCc Convert to smaller type checks    /RTCs Stack Frame runtime checking
/RTCu Uninitialized local usage checks
/clr[:option] compile for common language runtime, where option is:
    pure - produce IL-only output file (no native executable code)
    safe - produce IL-only verifiable output file
    oldSyntax - accept the Managed Extensions syntax from Visual C++ 2002/2003
    initialAppDomain - enable initial AppDomain behavior of Visual C++ 2002
    noAssembly - do not produce an assembly
/homeparams Force parameters passed in registers to be written to the stack
/GZ Enable stack checks (/RTCs)
/arch:AVX enable use of Intel(R) Advanced Vector Extensions instructions

                              -OUTPUT FILES-

/Fa[file] name assembly listing file    /FA[scu] configure assembly listing
/Fd[file] name .PDB file                /Fe<file> name executable file
/Fm[file] name map file                 /Fo<file> name object file
/Fp<file> name precompiled header file  /Fr[file] name source browser file
/FR[file] name extended .SBR file       /Fi[file] name preprocessed file
/doc[file] process XML documentation comments and optionally name the .xdc file

                              -PREPROCESSOR-

/AI<dir> add to assembly search path    /FU<file> forced using assembly/module
/C don't strip comments                 /D<name>{=|#}<text> define macro
/E preprocess to stdout                 /EP preprocess to stdout, no #line
/P preprocess to file                   /Fx merge injected code to file
/FI<file> name forced include file      /U<name> remove predefined macro
/u remove all predefined macros         /I<dir> add to include search path
/X ignore "standard places"

                                -LANGUAGE-

/Zi enable debugging information        /Z7 enable old-style debug info
/Zp[n] pack structs on n-byte boundary  /Za disable extensions
/Ze enable extensions (default)         /Zl omit default library name in .OBJ
/Zg generate function prototypes        /Zs syntax check only
/vd{0|1|2} disable/enable vtordisp      /vm<x> type of pointers to members
/Zc:arg1[,arg2] C++ language conformance, where arguments can be:
    forScope[-] - enforce Standard C++ for scoping rules
    wchar_t[-] - wchar_t is the native type, not a typedef
    auto[-] - enforce the new Standard C++ meaning for auto
    trigraphs[-] - enable trigraphs (off by default)
/openmp enable OpenMP 2.0 language extensions

                              -MISCELLANEOUS-

@<file> options response file           /?, /help print this help message
/bigobj generate extended object format /c compile only, no link
/errorReport:option Report internal compiler errors to Microsoft
    none - do not send report
(press <return> to continue)
    prompt - prompt to immediately send report
    queue - at next admin logon, prompt to send report (default)
    send - send report automatically
/FC use full pathnames in diagnostics   /H<num> max external name length
/J default char type is unsigned
/MP[n] use up to 'n' processes for compilation
/nologo suppress copyright message      /showIncludes show include file names
/Tc<source file> compile file as .c     /Tp<source file> compile file as .cpp
/TC compile all files as .c             /TP compile all files as .cpp
/V<string> set version string           /w disable all warnings
/wd<n> disable warning n                /we<n> treat warning n as an error
/wo<n> issue warning n once             /w<l><n> set warning level 1-4 for n
/W<n> set warning level (default n=1)   /Wall enable all warnings
/WL enable one line diagnostics         /WX treat warnings as errors
/Yc[file] create .PCH file              /Yd put debug info in every .OBJ
/Yl[sym] inject .PCH ref for debug lib  /Yu[file] use .PCH file
/Y- disable all PCH options             /Zm<n> max memory alloc (% of default)
/Wp64 enable 64 bit porting warnings

                                -LINKING-

/LD Create .DLL                         /LDd Create .DLL debug library
/LN Create a .netmodule                 /F<num> set stack size
/link [linker options and libraries]    /MD link with MSVCRT.LIB
/MT link with LIBCMT.LIB                /MDd link with MSVCRTD.LIB debug lib
/MTd link with LIBCMTD.LIB debug lib


c:\Users\ukhan\Documents\Auto_Security\Test_Code>

基本上,我正在尝试从 Microsoft Visual C++ 生成 MIPS R4000 的汇编代码。任何帮助表示赞赏。

【问题讨论】:

  • 是什么让您相信这应该可以开始?
  • 更正 - 实际选项是 /QMmipsX,我确实尝试使用 /QMmips1,但该选项也无效。是什么让我认为它可能?嗯,这就是微软文档所说的: Switch Description Default status /QMmips1
  • mdsn 说它只适用于 Visual Studio 2005
  • VS2010 不支持 MIPS。

标签: c++ visual-studio-2010 assembly mips


【解决方案1】:

曾经有一个在 MIPS 上运行的 Windows 桌面版本,由于缺乏使用,它在 2000 年停止使用。移动版本也发生了同样的情况,在 2010 年被苹果击中。因此,编译器支持也停止了,您需要 VS2008 或更低版本。

VS2008 中的交叉编译器位于 c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ce\bin\x86_mips。使用 /?:

显示的选项的片段
/QMmips2 MIPS II ISA (default)          /QMmips3 MIPS III ISA
/QMmips4 MIPS IV ISA                    /QMmips5 MIPS V ISA
/QMmips16 MIPS 16 ASE                   /QMmips32 MIPS 32 ISA
/QMmips64 MIPS 64 ISA
/QMn32[-] generate code for MIPS n32 mode
/QMR3900 optimize for r3900             /QMR4100 optimize for r4100
/QMR4200 optimize for r4200             /QMR4300 optimize for r4300
/QMR5400 optimize for r5400             /QMVIPER optimize for Viper
/QMRFWCE generic WinCE -QMFPE- MIPS     /QMRWCE generic WinCE MIPS (Default)
/QMFPE[-] use floating point emulation  /QMase3D use MIPS-3D ASE

VS2008 仍可通过 Amazon 等经销商获得,订阅 MSDN 即可免费获得,也可通过 Ebay 等拍卖网站获得。需要专业版才能获得移动支持。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-21
    • 2015-06-30
    • 1970-01-01
    • 2011-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多