Ask Your Question
0

gtesting a custom class

asked 2012-11-21 05:34:44 -0500

I created the test/myTest.cpp file, which includes the myClass.h header file.

When I compile with make test I get the error ‘MyClass’ does not name a type, where MyClass is the class defined in myClass.h (the error is located where I declare a new MyClass variable)

I think I am missing something with the cmakelists file..

What should I do to compile everything correctly?

I am using ros electric..

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2012-11-21 08:16:04 -0500

Your CMakeList should look something like this:

rosbuild_add_library(myClass_lib src/myClass.cpp)

rosbuild_add_gtest(myTest test/myTest.cpp)

target_link_libraries(myTest myClass_lib)

edit flag offensive delete link more

Comments

You are absolutely right... Everything was correct but I forgot to use the right namespace, which caused the error..

Francesco Sacchi gravatar image Francesco Sacchi  ( 2012-11-21 11:34:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-11-21 05:34:44 -0500

Seen: 52 times

Last updated: Nov 21 '12