Hi,
I'm trying to run a simple app in windows with cygwin environment.
Code:
#include <osgViewer/Viewer>
int main() {
osgViewer::Viewer viewer;
return 0;
}
My makefile:
Code:
CC=g++
#source, objects and executable
SOURCES=test.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=test
#pre-compile, compile and link flags
PFLAGS := -DNDEBUG
CFLAGS=-c -Wall
LDFLAGS=
#include, lib paths and libs
INC_PATHS := -I/cygdrive/c/dev/sdk/osg_3.0.1/include
LIB_PATHS := -L/cygdrive/c/dev/sdk/osg_3.0.1/lib
LIBS := -losg -losgGA -losgDB -losgViewer -losgText -losgUtil -lOpenThreads
#compile and link commands
all: $(SOURCES) $(EXECUTABLE)
rm *.o
mv test.exe ./bin
clean:
rm -f *.o
rm -rf ./bin/*.*
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LIB_PATHS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
.cpp.o:
$(CC) $(INC_PATHS) $(CFLAGS) $(PFLAGS) $< -o $@
Windows paths are correct, osgversion works fine and examples also with:
OpenSceneGraph Library 3.0.1
Now, everything seems to be correct but my "make all" output is:
Code:
make all
g++ -I/cygdrive/c/dev/sdk/osg_3.0.1/include -c -Wall -DNDEBUG test.cpp -o test.o
g++ -L/cygdrive/c/dev/sdk/osg_3.0.1/lib test.o -losg -losgGA -losgDB
-losgViewer -losgText -losgUtil -lOpenThreads -o test
test.o:test.cpp:(.text+0x13d): undefined reference to
`__imp___ZN9osgViewer6ViewerC1Ev'
test.o:test.cpp:(.text+0x14d): undefined reference to
`osgViewer::Viewer::~Viewer()'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: test.o:
bad reloc address 0x0 in section `.ctors'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: final link
failed: Invalid operation
collect2: ld returned 1 exit status
make: *** [test] Error 1
Makefile:29: recipe for target `test' failed
Don't know what is missing!
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51124#51124
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org