makefile help

Will someone please explain what is wrong with my makefile and how to fix it? I cannot figure out how to do it for the life of me.
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
#include <ncurses.h>
#include <iostream>
using namespace std;

int main() {
	initscr();
	printw("Hello, world!");
	refresh();
	getch();
	endwin();
	return 0;
}


I have this one file^ in my program titled "main.cpp." Here is my makefile:

1
2
3
4
5
6
7
8
9
10
.PHONY: clean All

All:
	@echo "----------Building project:[ Beads - Debug ]----------"
	@$(MAKE) -f  "Beads.mk"
clean:
	@echo "----------Cleaning project:[ Beads - Debug ]----------"
	@$(MAKE) -f  "Beads.mk" clean
main.o:	main.cpp stdio.h ncurses.h iostream
	g++ -Wall -g main.cpp -lncurses


The first two targets were automatically created by my IDE, I am trying to modify it to link with ncurses.

Many thanks!
Last edited on
Do not modify that file.

You should be able to specify in the IDE that you want that additional library. Then IDE will include it appropriately.
So I added ncurses in an options box for linking libraries and the program compiled and ran. However, now I get the error during runtime: "Error opening terminal: unknown." Does anyone know how to fix this?
Topic archived. No new replies allowed.