Why does the compiler not recognize some of the functions of a library?
I have enclosed the <ctime>
library in Qt but does not recognize its functions.
why? and how can I solve my problem?
Asked
Active
Viewed 31 times
-3

ΦXocę 웃 Пepeúpa ツ
- 47,427
- 17
- 69
- 97

Pasha
- 73
- 1
- 2
-
posting code and some error code messages will help us to help you! – ΦXocę 웃 Пepeúpa ツ Jul 30 '20 at 09:32
1 Answers
0
ofcourse compiler recognizes libs when they are properly included, functions are properly used (namespaces enclosed etc)
this example shows how to use a ctime
lib to print the actual date:
Note that the function time is enclosed in the namespace std
therefore std::time(...)
is a valid call
#include "mainwindow.h"
#include <QApplication>
#include <ctime>
#include <iostream>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
std::time_t result = std::time(nullptr);
std::cout << "x: "<< std::ctime(&result);
return a.exec();
}

ΦXocę 웃 Пepeúpa ツ
- 47,427
- 17
- 69
- 97