- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我一直在尝试使用 scons
和 SDL 从源代码编译 The Powder Toy(用 C++ 编写)。我承认我在编译/构建方面不是很有经验,但这看起来应该是可能的。
我在 Mac OSX 10.9 (Mavericks) 上运行;这导致了 SDL 的问题。然而,我找到了解决这个问题的方法,现在我已经成功安装了 XCode、XQuartz、命令行工具、scons 和 SDL。但是,如果我 cd
进入源目录并运行 scons --macosx --release --sse2 --nofft
我得到错误
src/PowderToySDL.cpp:6:10: fatal error:
'SDL.h' file not found #include "SDL.h"
^
很明显,找不到包含 SDL.h (./SDL/include) 的文件夹。我尝试添加标签
--sdl-dir="~/Desktop/Programming/SDL-1.2.15/include"
调用 scons,
但是同样的错误仍然存在。我检查了目录 ./SDL/include
,所有正确的文件都在那里;然而 scons 似乎并没有引用它们。
完整输出:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/src/PowderToySDL.o -c -w -std=c++98 -fkeep-inline-functions -O3 -ftree-vectorize -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/Lua.framework/Headers -m32 -msse2 -D_GNU_SOURCE -DUSE_STDINT -D_POSIX_C_SOURCE=200112L -DLUACONSOLE -DUSE_SDL -DMACOSX -DSTABLE -DX86 -DX86_SSE2 -Ibuild/src -Isrc -Ibuild/data -Idata -Ibuild/generated -Igenerated src/PowderToySDL.cpp
src/PowderToySDL.cpp:6:10: fatal error: 'SDL.h' file not found
#include "SDL.h"
^
1 error generated.
scons: *** [build/src/PowderToySDL.o] Error 1
scons: building terminated because of errors.
构建脚本:(SConstruct)
AddOption('--builddir',dest="builddir",default="build",help="Directory to build to.")
SConscript('SConscript', variant_dir=GetOption('builddir'), duplicate=0)
征兵
# ============
# SCons script
# ============
# the purpose of this script is to run a build of tpt from start to finish, including dependency checks.
# .. contents :: Table of Contents
# ============
# requirements
# ============
# stdlib
# ======
import os
import sys
import subprocess
import time
# 3rd party
# =========
# nothing besides scons.
# =================
# long commandlines
# =================
# .. : Fix for long command line - http://scons.org/wiki/LongCmdLinesOnWin32
# because of an implementation detail commandlines are limited to 10000 characters on windows using mingw. the following fix was copied from
# http://scons.org/wiki/LongCmdLinesOnWin32 and circumvents this issue.
class ourSpawn:
def ourspawn(self, sh, escape, cmd, args, env):
newargs = ' '.join(args[1:])
cmdline = cmd + " " + newargs
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
data, err = proc.communicate()
rv = proc.wait()
if rv:
print "====="
print err
print "====="
return rv
def SetupSpawn( env ):
if sys.platform == 'win32':
buf = ourSpawn()
buf.ourenv = env
env['SPAWN'] = buf.ourspawn
# ===================
# commandline options
# ===================
# the following defines all optional commandlines
AddOption('--opengl',dest="opengl",action='store_true',default=False,help="Build with OpenGL interface support.")
AddOption('--opengl-renderer',dest="opengl-renderer",action='store_true',default=False,help="Build with OpenGL renderer support. (requires --opengl)")
AddOption('--renderer',dest="renderer",action='store_true',default=False,help="Save renderer")
AddOption('--64bit',dest="_64bit",action='store_true',default=False,help="64-bit platform target")
AddOption('--static',dest="static",action="store_true",default=False,help="Static linking, reduces external library dependancies but increased file size")
AddOption('--pthreadw32-static',dest="ptw32-static",action="store_true",default=False,help="Use PTW32_STATIC_LIB for pthreadw32 headers")
AddOption('--python-ver',dest="pythonver",default=False,help="Python version to use for generator.py")
AddOption('--release',dest="release",action='store_true',default=False,help="Enable optimisations (Will slow down compiling)")
AddOption('--lua-dir',dest="lua-dir",default=False,help="Directory for lua includes")
AddOption('--sdl-dir',dest="sdl-dir",default=False,help="Directory for SDL includes")
AddOption('--tool',dest="toolprefix",default=False,help="Prefix")
AddOption('--sse',dest="sse",action='store_true',default=False,help="Enable SSE optimisations")
AddOption('--sse2',dest="sse2",action='store_true',default=False,help="Enable SSE2 optimisations")
AddOption('--sse3',dest="sse3",action='store_true',default=False,help="Enable SSE3 optimisations")
AddOption('--x86',dest="x86",action='store_true',default=True,help="Target Intel x86 platform")
AddOption('--nofft',dest="nofft", action='store_true',default=False,help="Do not use fftw3f for gravity.")
AddOption('--nolua',dest="nolua", action='store_true',default=False,help="Disable all lua scripting features.")
AddOption('--debugging', dest="debug", action="store_true", default=False, help="Enable debug options")
AddOption('--beta',dest="beta",action='store_true',default=False,help="Beta build.")
AddOption('--save-version',dest="save-version",default=False,help="Save version.")
AddOption('--minor-version',dest="minor-version",default=False,help="Minor version.")
AddOption('--build-number',dest="build-number",default=False,help="Build number.")
AddOption('--snapshot',dest="snapshot",action='store_true',default=False,help="Snapshot build.")
AddOption('--snapshot-id',dest="snapshot-id",default=False,help="Snapshot build ID.")
AddOption('--stable',dest="stable",default=True,help="Non snapshot build")
AddOption('--aao', dest="everythingAtOnce", action='store_true', default=False, help="Compile the whole game without generating intermediate objects (very slow), enable this when using compilers like clang or mscc that don't support -fkeep-inline-functions")
AddOption('--fullclean',dest="justwork",action='store_true',default=False,help="for when nothing else works. Deletes all sconscript temporary files.")
AddOption('--copy-env',dest="copy_env",action='store_true',default=False,help="copy some common enviroment variables from the parent enviroment.")
# using one of these commandline options is compulsory
AddOption('--win',dest="win",action='store_true',default=False,help="Windows platform target.")
AddOption('--lin',dest="lin",action='store_true',default=False,help="Linux platform target")
AddOption('--macosx',dest="macosx",action='store_true',default=False,help="Mac OS X platform target")
AddOption('--rpi',dest="rpi",action='store_true',default=False,help="Raspbain platform target")
# ============
# main program
# ============
# the gist of the compiling rules are defined here
if(GetOption("justwork")):
import shutil
try:
shutil.rmtree("../.sconf_temp/")
except:
print "couldn't remove .sconf_temp"
try:
os.remove("../.sconsign.dblite")
except:
print "couldn't remove .sconsign.dblite"
# platform selection
# ==================
# generic platform settings
# +++++++++++++++++++++++++
# check if a platform is specified.
# .. : TODO: make it suggest commandline options if it isn't
if((not GetOption('lin')) and (not GetOption('win')) and (not GetOption('rpi')) and (not GetOption('macosx'))):
print "You must specify a platform to target"
raise SystemExit(1)
# windows specific platform settings
# ++++++++++++++++++++++++++++++++++
# if the platform is windows switch to a mingw toolset, use the default otherwise
if(GetOption('win')):
env = Environment(tools = ['mingw'], ENV = os.environ)
else:
env = Environment(tools = ['default'], ENV = os.environ)
if(GetOption("copy_env")):
lstvar=["CC","CXX","LD","CFLAGS","LIBPATH"]
print "WARNING: enviroment copying enabled. changes in the enviroment can easily break the build process."
for var in lstvar:
if var in os.environ:
env[var]=os.environ[var]
print "WARNING: copying enviroment variable {}={!r}".format(var,os.environ[var])
# macosx specific platform settings
# +++++++++++++++++++++++++++++++++
# if we're not on MACOSX check for headers etc
if not GetOption("macosx"):
conf = Configure(env)
# if sdl-dir is set check if we can find the sdl header there, if we can't just pass the header path to the compiler.
if(GetOption("sdl-dir")):
if not conf.CheckCHeader(GetOption("sdl-dir") + '/SDL.h'):
print "sdl headers not found or not installed"
raise SystemExit(1)
else:
env.Append(CPPPATH=[GetOption("sdl-dir")])
else:
# otherwise try to parse the pkg config for sdl and grab the correct flags from there.
try:
env.ParseConfig('sdl-config --cflags')
env.ParseConfig('sdl-config --libs')
except:
if not conf.CheckLib("SDL"):
print "libSDL not found or not installed"
raise SystemExit(1)
# if lua is enabled try to parse the lua pgk-config, or the lua-dir option if given
if not GetOption("nolua"):
if(GetOption("lua-dir")):
if not conf.CheckCHeader(GetOption("lua-dir") + '/lua.h'):
print "lua5.1 headers not found or not installed"
raise SystemExit(1)
else:
env.Append(CPPPATH=[GetOption("lua-dir")])
try:
env.ParseConfig('pkg-config --cflags lua5.1')
env.ParseConfig('pkg-config --libs lua5.1')
except:
#Check for Lua lib
if not conf.CheckLib('lua5.1') and not conf.CheckLib('lua-5.1') and not conf.CheckLib('lua51') and not conf.CheckLib('lua'):
print "liblua5.1 not found or not installed"
raise SystemExit(1)
# if fft is enabled try to parse its config, fail otherwise.
if not GetOption('nofft'):
# Check for FFT lib
if not conf.CheckLib('fftw3f') and not conf.CheckLib('fftw3f-3'):
print "libfftw3f not found or not installed"
raise SystemExit(1)
# try to autodetect some libraries, fail otherwise
#Check for Bzip lib
if not conf.CheckLib('bz2'):
print "libbz2 not found or not installed"
raise SystemExit(1)
#Check for zlib
if not conf.CheckLib('z'):
print "libz not found or not installed"
raise SystemExit(1)
if not conf.CheckCHeader("bzlib.h"):
print "bzip2 headers not found"
raise SystemExit(1)
# finish the configuration
env = conf.Finish();
else:
# if we ARE on macosx add the libraries to LIBS
# .. : seems like we're terrible at mac support? what gives?
env.Append(LIBS=['z', 'bz2'])
if not GetOption('nofft'):
env.Append(LIBS=['fftw3f'])
# enviroment setup
# ================
# add the correct compiler flags.
# generic enviroment settings
# +++++++++++++++++++++++++++
# check if a tool prefix is set, and if it is select the propper tools for building.
# .. : TODO someone explain wtf this actually does
if GetOption("toolprefix"):
env['CC'] = GetOption("toolprefix")+env['CC']
env['CXX'] = GetOption("toolprefix")+env['CXX']
if GetOption('win'):
env['RC'] = GetOption("toolprefix")+env['RC']
# make sure the compiler can find the source data and generated files. enable warnings, set C++ flavor, and keep inline functions
env.Append(CPPPATH=['src/', 'data/', 'generated/'])
env.Append(CCFLAGS=['-w', '-std=c++98', '-fkeep-inline-functions'])
env.Append(LIBS=['pthread', 'm'])
env.Append(CPPDEFINES=["_GNU_SOURCE", "USE_STDINT", "_POSIX_C_SOURCE=200112L"])
# check all enabled libs, and add a define if they are enabled.
if not GetOption('nofft'):
env.Append(CPPDEFINES=["GRAVFFT"])
if not GetOption('nolua'):
env.Append(CPPDEFINES=["LUACONSOLE"])
# check if we need to use PTW32_STATIC_LIB for pthreadw32 headers, won't compile statically without this
if GetOption("ptw32-static"):
env.Append(CPPDEFINES=['PTW32_STATIC_LIB']);
# check if we need to do static linking.
if(GetOption('static')):
env.Append(LINKFLAGS=['-static-libgcc'])
# check if we need to compile the save renderer. add a define accordingly. compile the game by default.
if(GetOption('renderer')):
env.Append(CPPDEFINES=['RENDERER'])
else:
env.Append(CPPDEFINES=["USE_SDL"])
# apply optimisations if it's a release build
if(GetOption('release')):
if GetOption('macosx'):
env.Append(CCFLAGS=['-O3', '-ftree-vectorize', '-funsafe-math-optimizations', '-ffast-math', '-fomit-frame-pointer'])
else:
env.Append(CCFLAGS=['-O3', '-ftree-vectorize', '-funsafe-math-optimizations', '-ffast-math', '-fomit-frame-pointer', '-funsafe-loop-optimizations', '-Wunsafe-loop-optimizations'])
# rpi specific enviroment settings
# ++++++++++++++++++++++++++++++++
# check if we're compiling for raspberry pi, if we are include rpi specific libraries and defines.
if(GetOption('rpi')):
if(GetOption('opengl')):
env.ParseConfig('pkg-config --libs glew gl glu')
openGLLibs = ['GL']
env.Append(LIBS=['X11', 'rt'])
env.Append(CPPDEFINES=["LIN"])
# windows specific enviroment settings
# ++++++++++++++++++++++++++++++++++++
# check if we're compiling for windows, if we are include windows specific libraries and defines.
if(GetOption('win')):
openGLLibs = ['opengl32', 'glew32']
env.Prepend(LIBS=['mingw32', 'ws2_32', 'SDLmain', 'SDL'])
env.Append(CCFLAGS=['-std=gnu++98'])
env.Append(LIBS=['winmm', 'gdi32'])
env.Append(CPPDEFINES=["WIN"])
env.Append(LINKFLAGS=['-mwindows'])
if(GetOption('_64bit')):
env.Append(CPPDEFINES=['__CRT__NO_INLINE'])
env.Append(LINKFLAGS=['-Wl,--stack=16777216'])
# linux specific enviroment settings
# ++++++++++++++++++++++++++++++++++++
# check if we're compiling for linux, if we are include linux specific libraries and defines.
if(GetOption('lin')):
if(GetOption('opengl')):
env.ParseConfig('pkg-config --libs glew gl glu')
openGLLibs = ['GL']
env.Append(LIBS=['X11', 'rt'])
env.Append(CPPDEFINES=["LIN"])
if GetOption('_64bit'):
env.Append(LINKFLAGS=['-m64'])
env.Append(CCFLAGS=['-m64'])
else:
env.Append(LINKFLAGS=['-m32'])
env.Append(CCFLAGS=['-m32'])
# macosx specific enviroment settings
# ++++++++++++++++++++++++++++++++++++
# check if we're compiling for macosx, if we are include macosx specific libraries and defines.
if(GetOption('macosx')):
env.Append(CPPDEFINES=["MACOSX"])
env.Append(CCFLAGS=['-I/Library/Frameworks/SDL.framework/Headers'])
env.Append(CCFLAGS=['-I/Library/Frameworks/Lua.framework/Headers'])
if not GetOption('nofft'):
env.Append(LINKFLAGS=['-lfftw3f'])
env.Append(LINKFLAGS=['-framework'])
env.Append(LINKFLAGS=['SDL'])
env.Append(LINKFLAGS=['-framework'])
env.Append(LINKFLAGS=['Lua'])
env.Append(LINKFLAGS=['-framework']);
env.Append(LINKFLAGS=['Cocoa'])
#env.Append(LINKFLAGS=['-framework SDL'])
#env.Append(LINKFLAGS=['-framework Lua'])
#env.Append(LINKFLAGS=['-framework Cocoa'])
if GetOption('_64bit'):
env.Append(LINKFLAGS=['-m64'])
env.Append(CCFLAGS=['-m64'])
else:
env.Append(LINKFLAGS=['-m32'])
env.Append(CCFLAGS=['-m32'])
# defines
# =======
# A lot of commandline flags translate directly into defines. those flags follow:
if GetOption('_64bit'):
env.Append(CPPDEFINES=["_64BIT"])
if(GetOption('beta')):
env.Append(CPPDEFINES='BETA')
if(not GetOption('snapshot') and not GetOption('beta') and not GetOption('release') and not GetOption('stable')):
env.Append(CPPDEFINES='SNAPSHOT_ID=0')
env.Append(CPPDEFINES='SNAPSHOT')
elif(GetOption('snapshot') or GetOption('snapshot-id')):
if(GetOption('snapshot-id')):
env.Append(CPPDEFINES=['SNAPSHOT_ID=' + GetOption('snapshot-id')])
else:
env.Append(CPPDEFINES=['SNAPSHOT_ID=' + str(int(time.time()))])
env.Append(CPPDEFINES='SNAPSHOT')
elif(GetOption('stable')):
env.Append(CPPDEFINES='STABLE')
if(GetOption('save-version')):
env.Append(CPPDEFINES=['SAVE_VERSION=' + GetOption('save-version')])
if(GetOption('minor-version')):
env.Append(CPPDEFINES=['MINOR_VERSION=' + GetOption('minor-version')])
if(GetOption('build-number')):
env.Append(CPPDEFINES=['BUILD_NUM=' + GetOption('build-number')])
if(GetOption('x86')):
env.Append(CPPDEFINES='X86')
if(GetOption('debug')):
env.Append(CPPDEFINES='DEBUG')
env.Append(CCFLAGS='-g')
if(GetOption('sse')):
env.Append(CCFLAGS='-msse')
env.Append(CPPDEFINES='X86_SSE')
if(GetOption('sse2')):
env.Append(CCFLAGS='-msse2')
env.Append(CPPDEFINES='X86_SSE2')
if(GetOption('sse3')):
env.Append(CCFLAGS='-msse3')
env.Append(CPPDEFINES='X86_SSE3')
if(GetOption('opengl')):
env.Append(CPPDEFINES=["OGLI", "PIX32OGL"])
env.Append(LIBS=openGLLibs)
if(GetOption('opengl') and GetOption('opengl-renderer')):
env.Append(CPPDEFINES=["OGLR"])
elif(GetOption('opengl-renderer')):
print "opengl-renderer requires opengl"
raise SystemExit(1)
# compiling
# =========
# sources
# +++++++
# find all source files
# generic sources
# ---------------
sources=Glob("src/*.cpp")
sources+=Glob("src/*/*.cpp")
sources+=Glob("src/gui/*/*.cpp")
sources+=Glob("src/simulation/elements/*.cpp")
sources+=Glob("src/simulation/tools/*.cpp")
sources+=Glob("src/client/requestbroker/*.cpp")
if not GetOption('nolua'):
sources+=Glob("src/socket/*.c")
# windows specific sources
# ------------------------
if(GetOption('win')):
sources += env.RES('resources/powder-res.rc')
sources = filter(lambda source: not 'src\\simulation\\Gravity.cpp' in str(source), sources)
sources = filter(lambda source: not 'src/simulation/Gravity.cpp' in str(source), sources)
# macosx specific sources
# -----------------------
if(GetOption('macosx')):
sources +=["SDLMain.m"]
# apply `long commandlines`_ fix
# ==============================
# apply the commandline fix
SetupSpawn(env)
# find proper executable name
# ===========================
# use some settings to detect what name to use for the executable
programName = "powder"
if(GetOption('renderer')):
programName = "render"
if(GetOption('win')):
if(GetOption('renderer')):
programName = "Render"
else:
programName = "Powder"
if(GetOption('_64bit')):
programName += "64"
if(not (GetOption('sse2') or GetOption('sse3'))):
programName += "-legacy"
if(GetOption('macosx')):
programName += "-x"
if(GetOption('win')):
programName += ".exe"
# detect python executable name
# =============================
# detect the executable name for python so we can run some generator scripts
if(GetOption('pythonver')):
pythonVer = GetOption('pythonver')
elif(GetOption('lin')):
pythonVer = "python2"
else:
pythonVer = "python"
# Extra compiler flag to fix stack alignment
# When Windows creates the gravity calculation thread, it has 4 byte stack alignment
# But we need 16 byte alignment so that SSE instructions in FFTW work without crashing
if(GetOption('win')):
envCopy = env.Clone()
envCopy.Append(CCFLAGS=['-mstackrealign'])
#envCopy.Append(CCFLAGS=['-mincoming-stack-boundary=2'])
sources+=envCopy.Object('src/simulation/Gravity.cpp')
# run generator commands
# ======================
env.Command(['generated/ElementClasses.cpp', 'generated/ElementClasses.h'], Glob('src/simulation/elements/*.cpp'), pythonVer + " generator.py elements $TARGETS $SOURCES")
sources+=Glob("generated/ElementClasses.cpp")
env.Command(['generated/ToolClasses.cpp', 'generated/ToolClasses.h'], Glob('src/simulation/tools/*.cpp'), pythonVer + " generator.py tools $TARGETS $SOURCES")
sources+=Glob("generated/ToolClasses.cpp")
# final settings
# ==============
# make a MD5 checksum decide wether or not a file changed. we had some problems with using the modification date for this purpose.
env.Decider('MD5')
# set a defaukt target
t=env.Program(target=programName, source=sources)
Default(t)
最佳答案
您需要做的是通过 CPPPATH construction variable 设置包含路径,如下:
# Not sure if SCons will recognize the tilde (~), so
# you may have to put the complete absolute path
env.Append(CPPPATH='~/Desktop/Programming/SDL-1.2.15/include')
# Not sure if it should be ./SDL/include instead, but if more
# than one dir needs to be added, just use a list
# env.Append(CPPPATH=['~/Desktop/Programming/SDL-1.2.15/include', './SDL/include'])
关于c++ - 使用 scons 在 Mac OSX 10.9 上构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21522533/
#include using namespace std; class C{ private: int value; public: C(){ value = 0;
这个问题已经有答案了: What is the difference between char a[] = ?string?; and char *p = ?string?;? (8 个回答) 已关闭
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 此帖子已于 8 个月
除了调试之外,是否有任何针对 c、c++ 或 c# 的测试工具,其工作原理类似于将独立函数复制粘贴到某个文本框,然后在其他文本框中输入参数? 最佳答案 也许您会考虑单元测试。我推荐你谷歌测试和谷歌模拟
我想在第二台显示器中移动一个窗口 (HWND)。问题是我尝试了很多方法,例如将分辨率加倍或输入负值,但它永远无法将窗口放在我的第二台显示器上。 关于如何在 C/C++/c# 中执行此操作的任何线索 最
我正在寻找 C/C++/C## 中不同类型 DES 的现有实现。我的运行平台是Windows XP/Vista/7。 我正在尝试编写一个 C# 程序,它将使用 DES 算法进行加密和解密。我需要一些实
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
有没有办法强制将另一个 窗口置于顶部? 不是应用程序的窗口,而是另一个已经在系统上运行的窗口。 (Windows, C/C++/C#) 最佳答案 SetWindowPos(that_window_ha
假设您可以在 C/C++ 或 Csharp 之间做出选择,并且您打算在 Windows 和 Linux 服务器上运行同一服务器的多个实例,那么构建套接字服务器应用程序的最明智选择是什么? 最佳答案 如
你们能告诉我它们之间的区别吗? 顺便问一下,有什么叫C++库或C库的吗? 最佳答案 C++ 标准库 和 C 标准库 是 C++ 和 C 标准定义的库,提供给 C++ 和 C 程序使用。那是那些词的共同
下面的测试代码,我将输出信息放在注释中。我使用的是 gcc 4.8.5 和 Centos 7.2。 #include #include class C { public:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我的客户将使用名为 annoucement 的结构/类与客户通信。我想我会用 C++ 编写服务器。会有很多不同的类继承annoucement。我的问题是通过网络将这些类发送给客户端 我想也许我应该使用
我在 C# 中有以下函数: public Matrix ConcatDescriptors(IList> descriptors) { int cols = descriptors[0].Co
我有一个项目要编写一个函数来对某些数据执行某些操作。我可以用 C/C++ 编写代码,但我不想与雇主共享该函数的代码。相反,我只想让他有权在他自己的代码中调用该函数。是否可以?我想到了这两种方法 - 在
我使用的是编写糟糕的第 3 方 (C/C++) Api。我从托管代码(C++/CLI)中使用它。有时会出现“访问冲突错误”。这使整个应用程序崩溃。我知道我无法处理这些错误[如果指针访问非法内存位置等,
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一些 C 代码,将使用 P/Invoke 从 C# 调用。我正在尝试为这个 C 函数定义一个 C# 等效项。 SomeData* DoSomething(); struct SomeData {
这个问题已经有答案了: Why are these constructs using pre and post-increment undefined behavior? (14 个回答) 已关闭 6
我是一名优秀的程序员,十分优秀!