Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Template template parameter works in cpp file but not in header(with test case)
Template template parameter works in cpp file but not in header [message #910569] Mon, 10 September 2012 02:25 Go to next message
Jay Catherwood is currently offline Jay CatherwoodFriend
Messages: 2
Registered: September 2012
Junior Member
I'm having a problem using glm with CDT and I reduced it to this test case:

test.hpp:
#include <iostream>

template<template<typename> class T>
void thisFails (T<bool> t) {
	std::cout << "CDT won't compile this" << std::endl;
}


main.cpp:
#include "test.hpp"

template<template<typename> class T>
void thisWorks (T<bool> t) {
	std::cout << "This is fine" << std::endl;
}

template <class T>
class Dummy {
};

int main() {
	Dummy<bool> d;
	thisFails(d);
	thisWorks(d);
}


ThisWorks is just thisFails pasted into the cpp file. MinGW will compile and run this on the command line, but CDT using the same MinGW installation chokes on thisFails, saying "Invalid arguments 'Candidates are: void thisFails(?)'". There are also some boxes that look like unprintable characters.

Does anyone know what's going on here? Is it a problem with CDT or my configuration? This is on CDT 8.1, MinGW 4.7.1, and Windows XP SP3.
Re: Template template parameter works in cpp file but not in header [message #910583 is a reply to message #910569] Mon, 10 September 2012 03:13 Go to previous message
Jay Catherwood is currently offline Jay CatherwoodFriend
Messages: 2
Registered: September 2012
Junior Member
I've been looking at this some more and I found out that to make it work you only need the function declaration directly in the cpp file. The definition can go in the header. I still don't understand what's causing this.
Previous Topic:Eclipse C/C++ error message
Next Topic:API to attach header files to a C project in Eclipse CDT
Goto Forum:
  


Current Time: Fri Apr 26 02:25:44 GMT 2024

Powered by FUDForum. Page generated in 0.03236 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top