Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » No source available for "main() "
No source available for "main() " [message #232871] Tue, 14 April 2009 00:32 Go to next message
MichaelChen is currently offline MichaelChenFriend
Messages: 7
Registered: July 2009
Junior Member
Dear there,

While debugging, I got the messege, No source available for "main() ".
(1) my Main.cpp is in a subfolder, does this cause the problem?
(2) my Makefile has the following line:
CXXFLAGS=-DIB_USE_STD_STRING -Wall -O0 -Wno-switch
(3) I am using Version: 3.4.1, Build id: M20080911-1700
(4) Other executables in different subfolders are debuggable.

please let me know how to solve the problem. Thanks.

Mike
Re: No source available for "main() " [message #232878 is a reply to message #232871] Tue, 14 April 2009 02:47 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
mike wrote:
> Dear there,
> While debugging, I got the messege, No source available for "main() ".
> (1) my Main.cpp is in a subfolder, does this cause the problem?
> (2) my Makefile has the following line:
> CXXFLAGS=-DIB_USE_STD_STRING -Wall -O0 -Wno-switch
> (3) I am using Version: 3.4.1, Build id: M20080911-1700
> (4) Other executables in different subfolders are debuggable.
>
> please let me know how to solve the problem. Thanks.
>
> Mike
>
>
Make sure that your compile and link commands include options to include
debug information. Without debug information, the debugger has no way
to associate the executable to source.
Re: No source available for "main() ...can not debug [message #560032 is a reply to message #232878] Mon, 20 September 2010 20:25 Go to previous messageGo to next message
michelle  is currently offline michelle Friend
Messages: 87
Registered: April 2010
Location: South Africa
Member
David Wegener wrote on Tue, 14 April 2009 04:47

Make sure that your compile and link commands include options to include
debug information. Without debug information, the debugger has no way
to associate the executable to source.

Hello, I get the same error when trying to debug. If I navigate to Project Properties > C/C++ Build > Settings > Tool Settings, my compiler is already set to Maximum Debug Level (-g3) as shown below. I can't find out how to add a debug options to the MinGW C linker.

Anyone know where I'm going wrong? (Wascana installed on Helios 20100617-1415, but *not* the Wascana SDL)

GCC C Compiler:
command: gcc
options: -O0 -g3 -Wall -c -fmessage-length=0

MinGW C Linker:
command: gcc
options: --nothing--

Thanks in advance, Michelle
~

[Updated on: Tue, 21 September 2010 04:14]

Report message to a moderator

Re: No source available for "main() ...can not debug [message #560072 is a reply to message #560032] Tue, 21 September 2010 07:01 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
michelle wrote on Mon, 20 September 2010 22:25
Hello, I get the same error when trying to debug. If I navigate to Project Properties > C/C++ Build > Settings > Tool Settings, my compiler is already set to Maximum Debug Level (-g3) as shown below. I can't find out how to add a debug options to the MinGW C linker.

Anyone know where I'm going wrong? (Wascana installed on Helios 20100617-1415, but *not* the Wascana SDL)

GCC C Compiler:
command: gcc
options: -O0 -g3 -Wall -c -fmessage-length=0

MinGW C Linker:
command: gcc
options: --nothing--

Thanks in advance, Michelle
~

Only the compiler needs the debug option. The linker does not care about it. So your configuration is okay. Perhaps you debugged the release version (w/o debug info) of your application?


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: No source available for "main() ...can not debug [message #560110 is a reply to message #560072] Tue, 21 September 2010 08:59 Go to previous messageGo to next message
michelle  is currently offline michelle Friend
Messages: 87
Registered: April 2010
Location: South Africa
Member
Axel Mueller wrote on Tue, 21 September 2010 09:01
Perhaps you debugged the release version (w/o debug info) of your application?
Hi Axel, thanks for the reply Smile No, I checked my debug configuration and the C/C++ Application is set to "Debug/hellogui.exe"

What is strange is if you take a look at my code below, I can run the debugger if I use the code in (1) but can *not* run the debugger if I comment out (1) and use the code in (2).

Since my true application is started with a WinMain method I need to get (2) working... any ideas?

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

//(1)THIS WORKS: If use 'main' directly below (and comment out 'WinMain') then I am able to run the debugger
    //    int main(void) {
    //        puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
    //        return EXIT_SUCCESS;
    //    }



//(2)THIS DOESN'T: If I make a WinMain application I can not debug it, I get error: No source availible for "main() at 0x401a60"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {
    int myPlay = 0;
    MessageBox(NULL, "Hello: I run fine, I just can't be debugged!!", "WinMain Demo", MB_OK);
    myPlay = 99;
    return EXIT_SUCCESS;
}



Re: No source available for "main() ...can not debug [message #560159 is a reply to message #560110] Tue, 21 September 2010 11:35 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
OK, the debugger thinks that main() is the entry point (the default standard). You need the compiler and linker flag -mwindows. The the linker will define WinMain as the entry point.

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: No source available for "main() ...can not debug [message #560227 is a reply to message #560159] Tue, 21 September 2010 15:27 Go to previous messageGo to next message
michelle  is currently offline michelle Friend
Messages: 87
Registered: April 2010
Location: South Africa
Member
Axel Mueller wrote on Tue, 21 September 2010 13:35
OK, the debugger thinks that main() is the entry point (the default standard). You need the compiler and linker flag -mwindows. The the linker will define WinMain as the entry point.

Thanks Axel but that's not it either I'm afraid. I get the same error with the below settings when trying to debug...
**** Rebuild of configuration Debug for project hellogui ****

**** Internal Builder is used for build               ****
gcc -O0 -g3 -Wall -c -fmessage-length=0 -mwindows -osrc\hellogui.o ..\src\hellogui.c
gcc -mwindows -ohellogui.exe src\hellogui.o
Build complete for project hellogui
Time consumed: 1910  ms.  


any other suggestion I could try that you can think of?
Re: No source available for "main() ...can not debug [message #624804 is a reply to message #560227] Wed, 22 September 2010 06:02 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
any other suggestion I could try that you can think of?

I'm running out of ideas ...


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: No source available for "main() ...can not debug [message #624993 is a reply to message #624804] Wed, 22 September 2010 06:57 Go to previous messageGo to next message
michelle  is currently offline michelle Friend
Messages: 87
Registered: April 2010
Location: South Africa
Member
That's a first Axel Wink ...after weeks of struggling this is our last step for porting to helios. We have no option but to sort this out. A couple of questions if you don't mind:

1. From what I see below, the GDB automatically comes with the mingw toolset right?
c:\devtools\eclipse\eclipse\mingw\bin>gdb
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This GDB was configured as "mingw32".



2. If I look, in "About Eclipse Features" the version of 'GDB Common' is 7.0.0 whereas GDB 7.2 is now out. I don't know how to do it, but possibly try get this updated version into helios?

3. Is there another debugger option other than gdb for eclipse?

[Updated on: Wed, 22 September 2010 07:18]

Report message to a moderator

Re: No source available for "main() ...can not debug [message #625912 is a reply to message #624993] Wed, 22 September 2010 10:51 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Quote:
1. From what I see below, the GDB automatically comes with the mingw toolset right?

Correct.

Quote:
2. If I look, in "About Eclipse Features" the version of 'GDB Common' is 7.0.0 whereas GDB 7.2 is now out. I don't know how to do it, but possibly try get this updated version into helios?

In "About Eclipse Features" you will see the version of the Eclipse pluging for gdb. This has nothing to do with the actual gdb version. I don't think gdb 7.2 will help in this case. It seems more like a build problem.

Quote:
3. Is there another debugger option other than gdb for eclipse?

There is EDC. It is a new debugger that is integrated directly into Eclipse. It is still under development, so some features are missing and there might be bugs (don't know never tested it).
But as I said before, I don't think this is a debugger problem.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: No source available for "main() ...can not debug [message #625921 is a reply to message #625912] Wed, 22 September 2010 11:02 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
One question. If you run gdb from the command console outside of Eclipse then can you debug your application?

One more question Smile
In your debug launch the "Source" tab, can you check to see if you have the correct path to your project?


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google

[Updated on: Wed, 22 September 2010 11:07]

Report message to a moderator

Re: No source available for "main() ...can not debug [message #626165 is a reply to message #625921] Wed, 22 September 2010 12:31 Go to previous messageGo to next message
michelle  is currently offline michelle Friend
Messages: 87
Registered: April 2010
Location: South Africa
Member
Axel I think we got it.... I CAN NOT BELIEEEEEEVE it took soooooo long for us to figure this out!!!!!!! If I just hit "resume" Embarrassed
Embarrassed Embarrassed it finds WinAPP and debugging works as expected.

...perhaps its that setting that I saw somewhere about automatically always stopping at 'main'? mmm...

thanks Axel for your efforts Smile (again) Smile

http://michellepace.com/temp/resume.and.then.fixed.png
Re: No source available for "main() ...can not debug [message #626187 is a reply to message #626165] Wed, 22 September 2010 12:37 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Great!
Quote:
...perhaps its that setting that I saw somewhere about automatically always stopping at 'main'? mmm...

Of course, that's the problem. You should uncheck it. I don't know why it is per default activated. I always deactivate it.


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
icon14.gif  Re: No source available for "main() ...can not debug [message #626192 is a reply to message #626165] Wed, 22 September 2010 12:44 Go to previous message
michelle  is currently offline michelle Friend
Messages: 87
Registered: April 2010
Location: South Africa
Member
michelle wrote on Wed, 22 September 2010 14:31
...perhaps its that setting that I saw somewhere about automatically always stopping at 'main'? mmm...


Ja that appears to be it Smile

http://www.michellepace.com/temp/fix.png
Previous Topic:include sdl_image on Mac OSX
Next Topic:CDT on HPUX
Goto Forum:
  


Current Time: Tue Apr 23 10:43:02 GMT 2024

Powered by FUDForum. Page generated in 0.03955 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top