小编Mor*_*pfh的帖子

如何使用mingw从另一个文件中存在的main方法运行文件中存在的方法

我已经在netbeans上安装了mingw用于C编程.
然后我创建了一个文件"Myfile.c",我在其中创建了一个方法callme().
但是这个文件不包含main方法.
我想callme()从另一个包含main方法的文件中调用.

myfile.c文件

#include <stdio.h>
void callme() {
    printf("I am called");
}
Run Code Online (Sandbox Code Playgroud)

EntryFile.c

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
    // How to call callme() from here OR use this method anyhow.
    return (EXIT_SUCCESS);
}
Run Code Online (Sandbox Code Playgroud)

出于某些原因,我不想创建主方法Myfile.c.

编辑

myfile.c文件

#include <stdio.h>
void callme();
void callme() {
    printf("I am called");
}
Run Code Online (Sandbox Code Playgroud)

EntryFile.c

#include <stdio.h>

int main(int argc, char** argv) {
    callme();
}
Run Code Online (Sandbox Code Playgroud)

错误

"/C/MinGW/MSYS/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering …
Run Code Online (Sandbox Code Playgroud)

c netbeans mingw

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

标签 统计

c ×1

mingw ×1

netbeans ×1