2015-12-23 35 views
1

正在習慣於握住你的手的IDE我卡住了,不知道從哪裏開始尋找解決方案。我甚至不知道這種類型的問題被稱爲... 程序使用Xcode成功運行,但是當編譯並在Raspberry Pi上運行時,它會成功編譯並啓動,但不會給出任何輸出或錯誤。C++程序啓動並掛起時沒有錯誤

我都試過,除了頭去除一切,主要包含:

std::cout << "Test" << std::endl; 

仍然沒有輸出。 使用編譯:正在使用

 
g++-4.7 -I include -I include/interface -I /usr/local/ssl/include -I /home/pi/gateway/mysql-connector-c++-1.1.5 -I /home/pi/gateway/mysql-connector-c++-1.1.5/cppconn -I /home/pi/gateway/mysql-connector-c++-1.1.5/driver -l mysqlcppconn -lwiringPi -lpthread -ldl -L/home/pi/gateway/live -std=c++11 -D PRODUCTION -o Gateway main.cpp src/*.cpp /usr/local/ssl/lib/libcrypto.a /usr/local/ssl/lib/libssl.a; 

的存儲器3.6MB但CPU使用率是0%。

編輯: 純運氣我發現了這個問題,一個靜態成員對象在其構造函數中通過其中一個頭包含等待回調。問題依然存在,人們會從哪裏開始排除故障?我寧願下次不要依靠運氣!一次註釋掉一個頭文件會導致各種錯誤,因此會刪除編譯標誌。我已經使用上面的標誌成功編譯了最少量的代碼。

#include <iostream> 
#include <stdlib.h> 
#include <unistd.h> 
#include <csignal> 
#include <cstring> 
#include <fstream> 
#include "lightdevice.h" 
#include "websocketserver.h" 
#include "errorlog.h" 
#include "debuglog.h" 

int main (int argc, char *argv[]) 
{ 
    std::cout << "Why is this not printing?" << std::endl; 
    return EXIT_SUCCESS; 
} 
+0

我會嘗試每個這些標頭輪流。 –

+1

你可以發佈你的實際代碼嗎? – cat

+0

@ Cheersandhth.-Alf通過嘗試每種方法意味着什麼?怎麼樣? – Tim

回答

0

在調試器中運行時,可以檢查這些線程。查看調用堆棧並查找正在創建的對象。

+0

謝謝,現在我有地方可以開始了! – Tim