Skip to main content



      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] Sun, 09 September 2012 22:25 Go to next message
Eclipse UserFriend
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] Sun, 09 September 2012 23:13 Go to previous message
Eclipse UserFriend
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: Sat Jun 21 11:32:09 EDT 2025

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

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

Back to the top