由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - One question in C programming
相关主题
[合集] 请问-fno-implicit-templates的用处谁来解释一下这个是compiler问题吗?
a simple question about constructor关于Makefile的一个问题
这个结果是啥,为什么呢?question for C++ constant
Matlab如何在同文件内定义过程C++ 的 问题
where to define my template function[合集] Help! A simple C problem
overload "++i"里的operator“++”,怎么declare?[合集] MSVS.Net里面怎么才能显示出每一次compile的完全命令?
基础问题:在header里面define functionPython problem on 64 bit Linux
make 时候遇到 undefined reference 怎么办?C 和 C++ 的区别
相关话题的讨论汇总
话题: parsename话题: function话题: question话题: defined
进入Programming版参与讨论
1 (共1页)
f******e
发帖数: 582
1
I have one C program project1.c. When I compile it, I got the following
errors:
================
In function `main':
project1.c:(.text+0xa7): undefined reference to `parseName'
collect2: ld returned 1 exit status
================
I have checked, function parseName() is defined in project1.c What is the
problem here?
Thanks a lot.
D*******a
发帖数: 3688
2
namespace?

【在 f******e 的大作中提到】
: I have one C program project1.c. When I compile it, I got the following
: errors:
: ================
: In function `main':
: project1.c:(.text+0xa7): undefined reference to `parseName'
: collect2: ld returned 1 exit status
: ================
: I have checked, function parseName() is defined in project1.c What is the
: problem here?
: Thanks a lot.

r****t
发帖数: 10904
3
(or parseName function defined is not viable) scratch this. most likely parseName is not defined, though OP claimed it is.

【在 D*******a 的大作中提到】
: namespace?
b******n
发帖数: 592
4
in C?

【在 D*******a 的大作中提到】
: namespace?
p*********t
发帖数: 2690
5
好歹给个程序出来吧.

【在 f******e 的大作中提到】
: I have one C program project1.c. When I compile it, I got the following
: errors:
: ================
: In function `main':
: project1.c:(.text+0xa7): undefined reference to `parseName'
: collect2: ld returned 1 exit status
: ================
: I have checked, function parseName() is defined in project1.c What is the
: problem here?
: Thanks a lot.

j*****k
发帖数: 1198
6
Need declare the function before define it.
f********n
发帖数: 1163
7
贴出代码,至少相关函数的部分
r*********r
发帖数: 3195
8
if u cann't even understand this error message, better put all ur code in
one file.
c*********s
发帖数: 85
9
in c/c++, you need to declare the function before you define it as jobseek
said. More precisely, declare or define the function before you use it. In
other words, add one line to the top of the file or move the parseName
function up toward the top of the file.
...
void parseName();
or
void parseName()
{
// guts of the function
}
...
void main()
{
parseName();
}
h**i
发帖数: 712
10
定义parseName的文件应该包括在Makefile
你这显然是连接错误。

【在 f******e 的大作中提到】
: I have one C program project1.c. When I compile it, I got the following
: errors:
: ================
: In function `main':
: project1.c:(.text+0xa7): undefined reference to `parseName'
: collect2: ld returned 1 exit status
: ================
: I have checked, function parseName() is defined in project1.c What is the
: problem here?
: Thanks a lot.

m*********t
发帖数: 527
11
看到 ld 错误的还建议声明函数在顶部的都回去重练。要是没声明直接就是编译错误了。确实有可能是 make file 的问题。楼主没有给出怎么编译,多少个源代码文件什么的基本帮不了他。。。
a9
发帖数: 21638
12
同意,不过貌似楼主就一个c文件。

了。确实有可能是 make file 的问题。楼主没有给出怎么编译,多少个源代码文件什
么的基本帮不了他。。。

【在 m*********t 的大作中提到】
: 看到 ld 错误的还建议声明函数在顶部的都回去重练。要是没声明直接就是编译错误了。确实有可能是 make file 的问题。楼主没有给出怎么编译,多少个源代码文件什么的基本帮不了他。。。
1 (共1页)
进入Programming版参与讨论
相关主题
C 和 C++ 的区别where to define my template function
关于C++ STL编译的疑问overload "++i"里的operator“++”,怎么declare?
class D:public B;基础问题:在header里面define function
forward declarationmake 时候遇到 undefined reference 怎么办?
[合集] 请问-fno-implicit-templates的用处谁来解释一下这个是compiler问题吗?
a simple question about constructor关于Makefile的一个问题
这个结果是啥,为什么呢?question for C++ constant
Matlab如何在同文件内定义过程C++ 的 问题
相关话题的讨论汇总
话题: parsename话题: function话题: question话题: defined