Tag: visual studio

在Visual Studio中将C与程序集链接

我正在尝试将main.c程序与procedure.asm链接。 我有以下C程序和汇编程序。 main.c中 #include #include using namespace std; extern “C” { void ClearUsingIndex(int[], int); } static int Array[10] ={1, 2, 3, 4, 5, 6, 7, 8, 9, -1}; int main() { int size = 10; ClearUsingIndex( Array, size); system(“pause”); return 0; } procedure.asm ; Listing generated by Microsoft (R) Optimizing Compiler Version 17.00.50727.1 TITLE c:\Users\GS\documents\visual […]

未处理的exception0xC0000008:在动态重新编译器中指定了无效的句柄

代码是MIPS-> ARM动态重新编译器。 在运行recompile_function()多次之后,它会在下面代码的条件子句中崩溃,尽管在早期的函数运行期间它可以运行这行代码而没有任何问题。 void recompile_function(){ //recompilation code …… if (out > (u_char *)((u_char *)base_addr + (1 << TARGET_SIZE_2) – MAX_OUTPUT_BLOCK_SIZE – JUMP_TABLE_SIZE)) out = (u_char *)base_addr; // other code …… } 变量输出是用于编写重新编译代码的指针。 base_addr始终指向已分配内存空间的原始开始。 每次写入指令时,变量输出进行4个字节,而base_addr保持不变。 extern char extra_memory[33554432]; #define BASE_ADDR ((int)(&extra_memory)) void *base_addr; u_char *out; void new_dynarec_init() { protect_readwrite(); base_addr = ((int)(&extra_memory)); out = (u_char *)base_addr; […]

释放二维arrays – 检测到堆腐蚀

编辑:对不起伙计们,我忘了提到这是在VS2013中编码的。 我有一个全局声明的结构: typedef struct data //Struct for storing search & sort run-time statistics. { int **a_collision; } data; data data1; 然后我分配我的记忆: data1.a_collision = (int**)malloc(sizeof(int)*2); //Declaring outer array size – value/key index. for (int i = 0; i < HASH_TABLE_SIZE; i++) data1.a_collision[i] = (int*)malloc(sizeof(int)*HASH_TABLE_SIZE); //Declaring inner array size. 然后我初始化所有元素: //Initializing 2D collision data array. for (int […]

为什么我在尝试计算字符串字母数的程序中收到此错误?

调试断言失败! 程序:… Laske aakkoset \ Debug \Ohjelmontitehtävä4.1Laske aakkoset.exe文件:minkernel \ crts \ ucrt \ appcrt \ convert \ isctype.cpp Line: 36 Expression: c >= -1 && c <= 255 我的代码: #include #include int count_alpha(const char *str) { int i = 0; int j = 0; while (*str) { if (isalpha(str[j])) { i++; j++; str++; } else […]

错误C2011:’timezone’:’struct’类型重定义(postgres)

我正在努力建立一个。 dll文件用C函数扩展postgres服务器。 我正在使用visual studio 2012构建dll和PostgreSQL 9.2。 我导入所有目录postgres“\ include \ server *”但我有错误: 错误C2011:’timezone’:’struct’类型重新定义 错误C2011:’itimerval’:’struct’类型重新定义 在第205和214行的文件* pg_confi_os.h *中 我试过这个解决方案但没有成功。 如何解决这个问题呢?

Visual Studio 2017代码输出未显示

我正在使用Visual Studio 2017社区,我遇到了我的代码输出无法显示的问题。 之前,当我运行C代码(通常使用Ctrl + F5)时,输出将显示在输出窗口中,但由于某些原因,现在当我这样做时没有输出(类似于命令提示的窗口会逐渐闪烁并消失) 。 我没有改变任何东西,我真的很困惑为什么会发生这种错误。 有人有什么想法吗? 这是编写简单的“Hello World”程序并按Ctrl + F5后的屏幕。 我的代码输出通常会显示在底部的控制台框中,但现在它只显示构建结果。 当我创建一个新项目时,我单击Empty Project,然后添加一个项目并将其另存为.c源代码。 我一直在使用相同的方法,但突然遇到了问题。 谢谢。

CreateThread中的转换错误

当我尝试使用CreateThread函数时,我有一个奇怪的错误。 这是我的代码: HANDLE threads[3]; //threads[0] is printer, threads[1] is receiver, [2] is serverconn DWORD printer_id, receiver_id, serverconn_id; if( ((threads [0] = CreateThread(NULL, 0, printer_thread, (LPVOID) thread_args, 0, &printer_id)) == NULL) || ((recv_thread = threads [1] = CreateThread(NULL, 0, receiver_thread, (LPVOID) thread_args, 0, &receiver_id)) == NULL) || ((threads [2] = CreateThread(NULL, 0, serverconn_thread, (LPVOID) thread_args, 0, […]

无法在visual studio 2012中编译C.

我有一个较旧的c项目,它使用许多变量名,导致它无法在c ++, new , this等中编译。 所以,试着看看我是否可以编译,我已经这样做了: 新的空C ++项目 添加了一个新类,重命名了文件.c (下面的代码) 清空了头文件 项目属性 – > C / C ++ – >高级 – >编译为=编译为C代码(/ TC) TEST.C: #include “Test.h” int test() { int new = 123; return new; } 但它仍然抱怨new ,所以它不是纯粹的C编译。我错过了什么? 编辑 我知道new , this等是c++中的保留名称。 但我正在尝试将其编译为c而我正试图避免在一个大型项目中重命名。 如果我告诉它编译为c ,为什么它仍然强制执行这些保留名称?

如何让VC 2015生成一个DLL而不仅仅是一个lib文件?

我正在Visual Studio 2015中从源代码构建SDL_pnglite 。我已经完成并添加了对其依赖项(zlib和SDL2)的正确.h和.lib文件的引用,并设置了Configuration Properties-> General-> Project默认值 – >配置类型为DLL。 当我构建时,它成功构建,但它只生成.lib文件而不是.dll。 我错过了什么? 在过去,我曾经需要构建一个.dll就是配置类型设置,但这次它不起作用。

对命令提示符,Visual Studio exe和文本文件感到困惑?

标题并没有真正做到这个主题正义。 它实际上非常简单,我的问题是。 我有一个用C语言编写的程序(下面的代码)。 我希望这个程序创建一个exe文件,该文件可以通过命令提示符控制台窗口运行,并且还将文本文件作为参数。 所以,长话短说; 我需要在CMD的命令行中说这个: C:\ Users \ Username \ Desktop \ wrapfile.exe content.txt 我唯一的问题是让代码正确。 我想告诉Visual Studio:“您应该打开的文件在命令提示符窗口中作为参数给出,没有设置位置……” 我怎么做? 这是我的工作代码(虽然您将不得不在* fp定义中更改一些内容。 #include #include int main(int argc, char *argv[]) { FILE *fp; // declaring variable fp = fopen(“c:\\users\\*Put you’re PC username here*\\Desktop\\contents.txt”, “rb”); // opens the file if (fp != NULL) // checks the return value […]