Help debugging C++ programs
I'm new to Linux (Kubuntu) and I'm just writing my first program (in C++) for Linux but for some reason I can't debug it.
So to test it I've tried to make a Hello World! program i plain C and this works fine, but if I change the file extension to *.cpp and compiles i again the debugger apparently can't find any symbolic information.
Whats going on?
My code:
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello, world!\n");;
return 1;
}
My Makefile:
CC=g++
NAME=hello
OBJS= helloworld.o
CFLAGS= -g -o0
LDFLAGS=
$(NAME): $(OBJS)
$(CC) $(CFLAGS) -o $(NAME) $(OBJS) $(LDFLAGS)
After compiling I run gdb ("gdb hello") and do a list on main.
With the *.c file this works fine and I get a listing of the source but with the *.cpp file I get this: "No line number known for main."
|