-3

Yesterday I wrote a simple program. The problem is that g++ won't compile it -

main.cpp: In function ‘void display()’:
main.cpp:32:21: error: ‘loadObj’ was not declared in this scope
  loadObj("model.obj");

I don't understand why - everything has been included. I'm trying to build it with this command

g++ -Wall -o main objLoader.cpp main.cpp -lGL -lglut -lGLU

There is a link to source: CLICK

Any ideas?

Gogetek
  • 15
  • 6

3 Answers3

2

Your include guards in ObjLoader.h are wrong.

#ifdef __OBJLOADER_H_INCLUDED__

should be

#ifndef __OBJLOADER_H_INCLUDED__

Note the n after the if. As it currently stands, the contents of the header are always ignored by all source files.

haccks
  • 100,941
  • 24
  • 163
  • 252
ComicSansMS
  • 46,689
  • 13
  • 143
  • 152
1

try declaring the function with const char*

lkanab
  • 886
  • 1
  • 7
  • 19
1

Change your safe guards in your objLoader.h to:

#ifndef __OBJLOADER_H_INCLUDED__

#ifdef is "if defined" which obviously is not.

101010
  • 40,441
  • 10
  • 90
  • 155