Codelite Rev: 3034 on Windows 2003 SP2 is giving following error: 'mcount'
which I do not have it in any file!
--------------------------------------------------------------------------------------------------------------------------
----------Build Started--------
----------Building project:[ Crunch - Debug ]----------
C:/Projects/WorkSpace/Crunch/Crunch/crunch.c
24: undefined reference to `mcount'
177: undefined reference to `mcount'
C:/Projects/WorkSpace/Crunch/Crunch/inputh.c
23: undefined reference to `mcount'
46: undefined reference to `mcount'
61: undefined reference to `mcount'
C:/Projects/WorkSpace/Crunch/Crunch/main.c
34: undefined reference to `_monstartup'
----------Build Ended----------
----------Build Started--------
----------Building project:[ CrunchMake - Debug ]----------
Codelite SVN Build Rev: 3367 on Ubuntu 9.10 x64 gives no warning or error at all.
same result on building from command line or Visual Studio 2008 Team Suite too.
--------------------------------------------------------------------------------------------------------------------------
----------Building project:[ Crunch - Debug ]----------
gcc -c "/home/user/Projects/Crunch/Crunch/crunch.c" -pg -g -ansi -W -Wall -o ./Debug/crunch.o "-I." "-I."
gcc -c "/home/user/Projects/Crunch/Crunch/inputh.c" -pg -g -ansi -W -Wall -o ./Debug/inputh.o "-I." "-I."
gcc -c "/home/user/Projects/Crunch/Crunch/main.c" -pg -g -ansi -W -Wall -o ./Debug/main.o "-I." "-I."
gcc -o ./Debug/Crunch ./Debug/crunch.o ./Debug/inputh.o ./Debug/main.o "-L."
----------Build Ended----------
0 errors, 0 warnings
----------Build Started--------
make
----------Building project:[ CrunchMake - Debug ]----------
make: *** No targets specified and no makefile found. Stop.
----------Build Ended----------
0 errors, 0 warnings
undefined reference to `mcount'
-
- CodeLite Curious
- Posts: 5
- Joined: Fri Nov 13, 2009 7:05 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: undefined reference to `mcount'
Can u please paste here the entire build log you got on Windows when trying to build?sms1878 wrote:Codelite Rev: 3034 on Windows 2003 SP2 is giving following error: 'mcount'
which I do not have it in any file!
--------------------------------------------------------------------------------------------------------------------------
----------Build Started--------
----------Building project:[ Crunch - Debug ]----------
C:/Projects/WorkSpace/Crunch/Crunch/crunch.c
24: undefined reference to `mcount'
177: undefined reference to `mcount'
C:/Projects/WorkSpace/Crunch/Crunch/inputh.c
23: undefined reference to `mcount'
46: undefined reference to `mcount'
61: undefined reference to `mcount'
C:/Projects/WorkSpace/Crunch/Crunch/main.c
34: undefined reference to `_monstartup'
----------Build Ended----------
----------Build Started--------
----------Building project:[ CrunchMake - Debug ]----------
Codelite SVN Build Rev: 3367 on Ubuntu 9.10 x64 gives no warning or error at all.
same result on building from command line or Visual Studio 2008 Team Suite too.
--------------------------------------------------------------------------------------------------------------------------
----------Building project:[ Crunch - Debug ]----------
gcc -c "/home/user/Projects/Crunch/Crunch/crunch.c" -pg -g -ansi -W -Wall -o ./Debug/crunch.o "-I." "-I."
gcc -c "/home/user/Projects/Crunch/Crunch/inputh.c" -pg -g -ansi -W -Wall -o ./Debug/inputh.o "-I." "-I."
gcc -c "/home/user/Projects/Crunch/Crunch/main.c" -pg -g -ansi -W -Wall -o ./Debug/main.o "-I." "-I."
gcc -o ./Debug/Crunch ./Debug/crunch.o ./Debug/inputh.o ./Debug/main.o "-L."
----------Build Ended----------
0 errors, 0 warnings
----------Build Started--------
make
----------Building project:[ CrunchMake - Debug ]----------
make: *** No targets specified and no makefile found. Stop.
----------Build Ended----------
0 errors, 0 warnings
(Dont concatenate 2 builds here, hard to tell which one is which)
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 5
- Joined: Fri Nov 13, 2009 7:05 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: undefined reference to `mcount'
this is what i got in build window using codelite rev: 3034
----------Build Started--------
"mingw32-make.exe" -j 1 -f "Crunch.mk"
----------Building project:[ Crunch - Debug ]----------
gcc -c "C:/Projects/WorkSpace/Crunch/Crunch/crunch.c" -pg -g -ansi -W -Wall -o ./Debug/crunch.o "-I." "-I."
gcc -c "C:/Projects/WorkSpace/Crunch/Crunch/inputh.c" -pg -g -ansi -W -Wall -o ./Debug/inputh.o "-I." "-I."
gcc -c "C:/Projects/WorkSpace/Crunch/Crunch/main.c" -pg -g -ansi -W -Wall -o ./Debug/main.o "-I." "-I."
gcc -o ./Debug/Crunch ./Debug/crunch.o ./Debug/inputh.o ./Debug/main.o "-L."
./Debug/crunch.o: In function `css_handler':
C:/Projects/WorkSpace/Crunch/Crunch/crunch.c:24: undefined reference to `mcount'
./Debug/crunch.o: In function `jscript_handler':
C:/Projects/WorkSpace/Crunch/Crunch/crunch.c:177: undefined reference to `mcount'
./Debug/inputh.o: In function `scan_input':
C:/Projects/WorkSpace/Crunch/Crunch/inputh.c:23: undefined reference to `mcount'
./Debug/inputh.o: In function `scan_output':
C:/Projects/WorkSpace/Crunch/Crunch/inputh.c:46: undefined reference to `mcount'
./Debug/inputh.o: In function `is_space':
C:/Projects/WorkSpace/Crunch/Crunch/inputh.c:61: undefined reference to `mcount'
./Debug/inputh.o:C:/Projects/WorkSpace/Crunch/Crunch/inputh.c:73: more undefined references to `mcount' follow
./Debug/main.o: In function `main':
C:/Projects/WorkSpace/Crunch/Crunch/main.c:34: undefined reference to `_monstartup'
collect2: ld returned 1 exit status
mingw32-make.exe: *** [Debug/Crunch] Error 1
----------Build Ended----------
6 errors, 0 warnings
----------Build Started--------
"mingw32-make.exe" -j 1 -f "Crunch.mk"
----------Building project:[ Crunch - Debug ]----------
gcc -c "C:/Projects/WorkSpace/Crunch/Crunch/crunch.c" -pg -g -ansi -W -Wall -o ./Debug/crunch.o "-I." "-I."
gcc -c "C:/Projects/WorkSpace/Crunch/Crunch/inputh.c" -pg -g -ansi -W -Wall -o ./Debug/inputh.o "-I." "-I."
gcc -c "C:/Projects/WorkSpace/Crunch/Crunch/main.c" -pg -g -ansi -W -Wall -o ./Debug/main.o "-I." "-I."
gcc -o ./Debug/Crunch ./Debug/crunch.o ./Debug/inputh.o ./Debug/main.o "-L."
./Debug/crunch.o: In function `css_handler':
C:/Projects/WorkSpace/Crunch/Crunch/crunch.c:24: undefined reference to `mcount'
./Debug/crunch.o: In function `jscript_handler':
C:/Projects/WorkSpace/Crunch/Crunch/crunch.c:177: undefined reference to `mcount'
./Debug/inputh.o: In function `scan_input':
C:/Projects/WorkSpace/Crunch/Crunch/inputh.c:23: undefined reference to `mcount'
./Debug/inputh.o: In function `scan_output':
C:/Projects/WorkSpace/Crunch/Crunch/inputh.c:46: undefined reference to `mcount'
./Debug/inputh.o: In function `is_space':
C:/Projects/WorkSpace/Crunch/Crunch/inputh.c:61: undefined reference to `mcount'
./Debug/inputh.o:C:/Projects/WorkSpace/Crunch/Crunch/inputh.c:73: more undefined references to `mcount' follow
./Debug/main.o: In function `main':
C:/Projects/WorkSpace/Crunch/Crunch/main.c:34: undefined reference to `_monstartup'
collect2: ld returned 1 exit status
mingw32-make.exe: *** [Debug/Crunch] Error 1
----------Build Ended----------
6 errors, 0 warnings
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: undefined reference to `mcount'
If you are using any third party libraries, make sure that they are too built with GCC4.4.0
Other than that it looks like a simple link error, can u paste the relevant code?
Eran
Other than that it looks like a simple link error, can u paste the relevant code?
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 5
- Joined: Fri Nov 13, 2009 7:05 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: undefined reference to `mcount'
this is one the functions giving the error.
int scan_input(const int argc, const char *args[], int *ptype)
{
int i;
for (i = 0; i < argc; ++i)
{
if (strcmp("-c", args) == 0)
{
*ptype = 1;
return i + 1;
}
else if (strcmp("-j", args) == 0)
{
*ptype = 2;
return i + 1;
}
}
*ptype = 0;
return 0;
}
int scan_input(const int argc, const char *args[], int *ptype)
{
int i;
for (i = 0; i < argc; ++i)
{
if (strcmp("-c", args) == 0)
{
*ptype = 1;
return i + 1;
}
else if (strcmp("-j", args) == 0)
{
*ptype = 2;
return i + 1;
}
}
*ptype = 0;
return 0;
}
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: undefined reference to `mcount'
This symbols are part of the -pg (profiling switch).
To fix this, add -pg to linker options as well and it will fix your problems
Googling your error could have fixed it in minutes:
http://old.nabble.com/Profiling-Trouble ... 57390.html
Eran
To fix this, add -pg to linker options as well and it will fix your problems
Googling your error could have fixed it in minutes:
http://old.nabble.com/Profiling-Trouble ... 57390.html
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 5
- Joined: Fri Nov 13, 2009 7:05 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: undefined reference to `mcount'
thanks. i found it out after reading the gcc manual again
one question: is there anyway to pass -lm end of each compile command in make file?
one question: is there anyway to pass -lm end of each compile command in make file?
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: undefined reference to `mcount'
Try to add it in the linker options:
project settings -> linker -> linker options
Eran
project settings -> linker -> linker options
Eran
Make sure you have read the HOW TO POST thread